> For the complete documentation index, see [llms.txt](https://tvn.gitbook.io/test-automation-with-python/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tvn.gitbook.io/test-automation-with-python/appium/setup-appium-on-macos.md).

# Setup Appium on MacOS

1. Install Homebrew:<br>

2. Install Node.js and Appium:

   ```bash
   brew install node
   npm install -g appium
   ```

3. Install JDK:

   ```
   brew install --cask adoptopenjdk
   ```

4. Install Android SDK:
   * Download and install Android Studio from the official website.
   * Open Android Studio and select "Configure" -> "SDK Manager".
   * Under the "SDK Platforms" tab, select the desired Android versions to download.
   * Under the "SDK Tools" tab, select "Android SDK Build-Tools" and "Android Emulator" to install.

5. Set environment variables:
   * ```bash
     Add the following lines to your .bash_profile or .zshrc file:
     export JAVA_HOME=$(/usr/libexec/java_home)
     export ANDROID_HOME=/Users/<your-username>/Library/Android/sdk
     export PATH=$PATH:$ANDROID_HOME/tools
     export PATH=$PATH:$ANDROID_HOME/platform-tools

     ```

6. Install Appium dependencies:

   ```bash
   npm install -g appium-doctor
   appium-doctor --android
   appium-doctor --ios
   ```

7. Connect a physical device or create an emulator:

   * For Android: Connect your Android device via USB, or create an Android emulator using Android Studio.
   * For iOS: Create an iOS simulator using Xcode.

   <br>

8. Launch Appium server:

   ```
   appium
   ```
