Running ADB on a Mac Terminal: A Step-by-Step Guide

Running ADB on a Mac Terminal: A Step-by-Step Guide

21 May 2024 Stephan Petzl Leave a comment Tech-Help

Setting up ADB (Android Debug Bridge) on a Mac terminal can be a bit tricky for new users. This guide will help you configure ADB correctly on your Mac so you can start using it for your Android development needs.

Step 1: Locate Your ADB Directory

First, you need to find the path to your ADB directory. If you have installed Android Studio, the path is typically:

  • /Users/<your_username>/Library/Android/sdk/platform-tools/

To confirm this path, you can navigate through Android Studio:

  • Open Android Studio
  • Go to Preferences > Appearance & Behavior > System Settings > Android SDK
  • Note the path under the Android SDK Location

Step 2: Adding ADB to Your PATH

To use ADB from any terminal window, you need to add it to your PATH environment variable. This can be done by modifying your shell profile file. The exact file to modify depends on your shell. For most users, this will be ~/.bash_profile or ~/.zshrc (for users on macOS Catalina or later).

For Bash Users:

echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools/' >> ~/.bash_profile
source ~/.bash_profile

After running these commands, you can verify the setup by typing:

adb devices

For Zsh Users (macOS Catalina and later):

echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools/' >> ~/.zshrc
source ~/.zshrc

After updating your ~/.zshrc file, verify the setup by running:

adb devices

Step 3: Running ADB Commands

With ADB added to your PATH, you can now run ADB commands from any terminal window. For example, to list connected devices, simply use:

adb devices

If you encounter any issues, ensure that your terminal is using the correct profile file and that the ADB path is correctly specified.

Additional Resources

For more detailed guides on working with ADB, check out our related articles:

Streamlining Your Testing Workflow

Managing and running ADB commands can be time-consuming, especially when dealing with complex test scenarios. This is where Repeato comes in handy. Repeato is a no-code test automation tool designed for iOS and Android, allowing you to create, run, and maintain automated tests efficiently. With built-in support for ADB commands via script steps, Repeato ensures that your tests are executed in the correct sequence, saving you valuable time and effort.

Learn more about how Repeato can enhance your testing workflow on our About page.

Like this article? there’s more where that came from!