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

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

30 November 2024 Stephan Petzl Leave a comment Tech-Help

Android Debug Bridge (ADB) is a versatile command-line tool that lets you communicate with an Android device. If you’re encountering the error “adb command not found” on your Mac terminal, this guide will walk you through the process of setting up ADB correctly.

Understanding the Issue

The error typically occurs when the terminal cannot locate the ADB executable in your system’s PATH. This can happen even if ADB is installed in the correct directory. The solution is to add ADB’s path to your environment variables.

Solution for macOS Bash Users

If you’re using the Bash shell, follow these steps:

  1. Open your terminal.
  2. Type the following command to add ADB to your PATH:
  3. echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools/' >> ~/.bash_profile
  4. Source your bash profile to apply the changes immediately:
  5. source ~/.bash_profile
  6. Verify the setup by running:
  7. adb devices

Solution for macOS Zsh Users

For users on macOS Catalina or later, using the Zsh shell:

  1. Open your terminal.
  2. Execute the following command:
  3. echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools/' >> ~/.zshrc
  4. Source your Zsh configuration file:
  5. source ~/.zshrc
  6. Check if ADB is correctly configured:
  7. adb devices

Alternative Temporary Solution

If you prefer not to modify your environment variables, you can run ADB directly from its directory:

  1. Navigate to the platform-tools directory:
  2. cd ~/Library/Android/sdk/platform-tools/
  3. Run ADB with a dot-slash prefix:
  4. ./adb devices

Further Reading

For more detailed instructions on setting up ADB and troubleshooting common issues, consider visiting our related articles:

Enhance Your Testing with Repeato

While setting up ADB manually can be a hassle, Repeato simplifies the testing process with its no-code test automation capabilities for iOS and Android. Repeato integrates ADB, allowing you to execute ADB commands seamlessly through “script steps”. This feature ensures precise timing and execution, making your test automation tasks more efficient. Explore how Repeato can enhance your app testing by visiting our Android Testing Tool page.

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