Skip to content

Scripts to set up and launch Android emulators and iOS simulators from the command line. Great for fresh machines, CI runners, and anyone who prefers the terminal.

Notifications You must be signed in to change notification settings

jonepl/Mobile-Emulator-Simulator-Bootstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Mobile Emulator/Simulator Bootstrap

Scripts to set up and launch Android emulators and iOS simulators from the command line. Great for fresh machines, CI runners, and anyone who prefers the terminal.

Repo layout (current)

.
├─ android
│  ├─ android_emu_setup.sh   # Android: installs/updates SDK bits, creates AVD(s)
│  └─ conemu.sh              # Android: lists/selects an AVD and launches it
└─ ios
   ├─ ios_simu_setup.sh  # iOS: installs/initializes Simulator runtime(s), creates a device if needed
   └─ consimu.sh             # iOS: lists/selects a device and launches Simulator

Prerequisites

macOS (required for iOS; recommended for Android)

  • Xcode installed from the App Store (for iOS Simulator)

  • Xcode command-line tools:

    xcode-select --install
  • First-run/License (only once per machine):
    sudo xcodebuild -license accept
    sudo xcodebuild -runFirstLaunch
    

Android (macOS/Linux)

  • Java (JDK 11+ recommended)

  • Android SDK / Command-line tools installed, with these on your PATH:

    • $ANDROID_SDK_ROOT/emulator
    • $ANDROID_SDK_ROOT/platform-tools
    • $ANDROID_SDK_ROOT/cmdline-tools/latest/bin

Typical macOS ~/.zshrc snippet:

export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"
export PATH="$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$PATH"

Quick Start

  1. Make scripts executable:
chmod +x android/android_emu_setup.sh android/conemu.sh \
        ios/ios_simu_setup.sh ios/consimu.sh
  1. iOS (macOS only)
# One-time setup: install a Simulator runtime and create a device if missing
./ios/ios_simu_setup.sh

# Launch: interactively select a device (or pass a name/UDID)
./ios/consimu.sh
# Examples:
# ./ios/consimu.sh "iPhone 15"
# ./ios/consimu.sh 12345678-ABCD-...-EF01
  1. Android
# One-time setup: install SDK components and create an AVD if missing
./android/android_emu_setup.sh

# Launch: interactively select an AVD (or pass a name)
./android/conemu.sh
# Examples:
# ./android/conemu.sh "Pixel_7_API_35"

What the scripts do

iOS (ios/ios_simu_setup.sh and ios/consimu.sh)

Setup:

  • Verifies Xcode CLTs and selected Xcode.
  • Ensures at least one iOS Simulator runtime is installed (e.g., via xcodebuild -downloadPlatform iOS).
  • Creates a default device (e.g., “Auto iPhone”) if none exist.

Launch:

  • Lists all available iOS devices with runtime + state.
  • Lets you choose interactively, or pass a name/UDID.
  • Boots the device (idempotent) and opens Simulator focused on it.

Android (android/android_emu_setup.sh and android/conemu.sh)

Setup:

  • Ensures sdkmanager, avdmanager, emulator are available.
  • Installs/Updates required SDK packages (platforms, system images, platform-tools).
  • Creates an AVD (e.g., Pixel device) if none exist.

Launch:

  • Lists existing AVDs; you can select interactively or pass an AVD name.
  • Starts the emulator with sensible defaults (GPU accel, cold boot as needed).

Non-interactive usage

Both “launch” scripts support passing a target directly:

iOS:

./ios/consimu.sh "iPhone 15"
# or pass a UDID
./ios/consimu.sh 12345678-ABCD-...-EF01

Android:

./android/conemu.sh "Pixel_7_API_35"

Troubleshooting

iOS

“Xcode command line tools not found”

  • Run xcode-select --install.

“Xcode not selected”

  • sudo xcode-select -s /Applications/Xcode.app

“No iOS Simulator runtimes found”

  • Run the setup script: ./ios/ios_simu_setup.sh

  • If automatic download fails, manually download an “iOS xx Simulator Runtime.dmg” from Apple Developer and install:

    xcrun simctl runtime add ~/Downloads/iOS_xx_Simulator_Runtime.dmg
    

Devices list is empty after setup

  • Open Simulator once: open -a Simulator (completes first-run tasks).

  • Re-run setup to auto-create a device.

Android

sdkmanager/avdmanager not found

  • Ensure $ANDROID_SDK_ROOT and PATH are set as shown above.

No AVDs found

  • Run the setup script: ./android/android_emu_setup.sh

Emulator fails to boot

  • Try a cold boot: emulator -avd -no-snapshot-load

  • Ensure hardware virtualization is enabled (Intel VT-x/AMD-V on Linux/Windows; macOS Apple Silicon uses ARM images).

Clean up

iOS: delete a device

xcrun simctl list devices
xcrun simctl delete <UDID>

Android: delete an AVD

avdmanager delete avd -n <AVD_NAME>

Conventions & Notes

  • Scripts are idempotent where possible: re-running setup is safe.
  • iOS requires macOS and a working Xcode install.
  • Android scripts should work on macOS and Linux. On Windows, use WSL or Git-Bash with the SDK tools available on PATH.

About

Scripts to set up and launch Android emulators and iOS simulators from the command line. Great for fresh machines, CI runners, and anyone who prefers the terminal.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages