# 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
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tvn.gitbook.io/test-automation-with-python/appium/setup-appium-on-macos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
