Using the Android tools directly from Terminal (Mac OS)

Using the Android tools directly from Terminal (Mac OS) cover

I’ve recently noticed that using android tools like the adb or the emulator directly from the terminal weren’t as common as I thought it would be.

It can be a bit tricky at first to configure but aftward you’ll see that it’s really handy for development.

  1. Launch the Terminal app
  2. Open the bash_profile
    nano ~/.bash_profile
  3. Add your Android SDK path:
    export ANDROID_SDK_ROOT=/Users/${whois}/Library/Android/sdk
    export PATH=$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools:$PATH
  4. Press ctrl+x followed by y and enter to save your changes.

That’s it, you’re all set! 🙌

Oh, and you don’t need to launch the Terminal app you can use the one that’s already built-in Android Studio:

Terminal inside Android Studio
Terminal inside Android Studio

Now feel free to try out some of the most common adb commands:

Or using the emulator:

emulator -list-avds
emulator @<your_emulator_name> -dns-server