If you like use the terminal and knows how slow it is for macOS to open Xcode and Android Studio in an attempt to get the emulators/simulators started, this article is for you.
Before going to the tutorial, make sure you have Xcode and Android Studio properly installed with their command line tools on your macOS.
With these two NPM packages that can help you, it's start-ios-simulator
& start-android-emulator
. Run the following commands to install:
For android emulator:
npm install -g start-android-emulator
For iOS simulator:
npm install -g start-ios-simulator
For android just run the command below and it will not only list the emulators available to start, it will also ask you if you intend to clean the device's data to start it.
In the iOS simulator you will have all the options available to start.
Starting Android Emulator
You can also run the default emulator command that's in that developer.android.com doc.
To list emulators:
emulator -list-avds
Just reference the device's compiler path, start the emulator and specify the device name.
/Users/seu.user/Library/Android/sdk/emulator/emulator -avd Pixel_2_API_29 -netdelay none -netspeed full
In your .bash_profile file you can even create an alias to run just a short command in the terminal.
export ANDROID_HOME=/Users/{YourUsername}/Library/Android/sdk/
alias run-emulator=”$ANDROID_HOME/emulator/emulator @Pixel_XL_API_27"
Start iOS Simulator
Apple has simctl
binary for interacting with iOS simulators from the command line. It's very similar to adb for Android. We can access all available options using the help command.
$ xcrun simctl help
List all simulators:
xcrun simctl list --json
To launch the simulator app:
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/
If you want to start a specific simulator, just find the id listed in the xcrun sumctl list — json
command and run the command:
xcrun simctl boot BE53CBFF-4900–4F10-A1D4-B451AB4C9E7E
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/
Top comments (0)