Android Emulator Setup on macOS with Android CLI
In my earlier guide to setting up an Android emulator on macOS, I installed the Android SDK Command-line Tools and used sdkmanager and avdmanager directly. Google now offers Android CLI, a higher-level command-line tool for setting up SDK packages, creating virtual devices, and working with Android projects.
Android CLI is not a replacement for the Android SDK itself. It gives you a single interface for managing the SDK and emulator, while the platform packages and emulator are still installed as SDK components. This walkthrough uses Android CLI to prepare a command-line Android development environment without opening Android Studio.
Keep an existing Android SDK
SDK packages you already installed with sdkmanager remain installed and can continue to be used; Android CLI does not invalidate them. It may use a different SDK directory by default, though. To have it use your existing SDK, pass that SDK root with --sdk:
android --sdk="$ANDROID_HOME" sdk list
For example, if you followed the earlier guide and set ANDROID_HOME to Homebrew’s android-commandlinetools directory, this command lists the packages already installed there. Use the same --sdk option before other android commands that should operate on that SDK. Otherwise, Android CLI may install packages into its own configured SDK directory instead.
🛠 Install Android CLI
Install Homebrew first if it is not already available. Google distributes Android CLI through its Homebrew tap, for both Apple Silicon and Intel Macs:
brew tap android/tap
brew install temurin21
brew install android-cli
Update the CLI and verify that the shell can find it:
android update
android --version
If android is not found, open a new terminal and check that Homebrew’s binary directory is on your PATH:
command -v android
Android CLI can also install an android-cli skill for supported coding agents. This is optional and is not required for the terminal workflow in this post:
android init
Check the SDK location
Android CLI reports the SDK directory it is using, as well as its version:
android info
To print only the SDK path:
android info sdk
You can use that default location for Android projects, or provide another SDK directory for an individual command with --sdk=/path/to/android-sdk. To make that override persistent, add the option on its own line to ~/.androidrc:
--sdk=/path/to/android-sdk
📦 Install SDK packages
List installed packages and browse the available Android platforms and emulator images:
android sdk list
android sdk list --all "platforms/*"
android sdk list --all "system-images/*"
Install the platform tools and emulator, then install a platform and system image from the package paths shown by the previous commands. Package paths use / separators. Select a system image that matches your target Android API level and Mac architecture; Apple Silicon Macs generally use arm64-v8a, while Intel Macs use x86_64.
android sdk install platform-tools emulator
android sdk install "platforms/android-<api>" "system-images/android-<api>/<image>/<architecture>"
Replace the angle-bracketed values with package paths that are actually listed for your machine. For example, the system-image path includes the Android API, image variant, and architecture. The available package names and versions change over time, so listing them first avoids relying on stale version numbers.
android sdk install "build-tools/37.1.0" "platforms/android-37.1" "system-images/android-37.1/google_apis_ps16k/arm64-v8a"
Check the installed components when the downloads finish:
android sdk list
📱 Create and start an emulator
Android CLI can show its available hardware profiles. The default profile is medium_phone:
android emulator create --list-profiles
android emulator create medium_phone
List the created virtual devices, then start the device by the name shown in the list:
android emulator list
android emulator start medium_phone
The start command waits until the emulator has finished booting. For a headless session, such as a CI job, use:
android emulator start --headless medium_phone
Next steps
The emulator and SDK are now available to Android projects. Android CLI also includes commands for creating projects, building and running apps, and inspecting devices. Browse the command reference for the SDK and emulator commands, or see the Android CLI installation options for non-Homebrew installs.
For a project built with Gradle, install a JDK version compatible with that project’s Gradle and Android Gradle Plugin versions.