Fix: zsh: command not found: adb (Android)


% adb devices

zsh: command not found: adb

If you are trying to run a adb command on the Mac Terminal and you get the error "zsh command not found adb" then the most common issue reasons for this is as follows.


Reasons for the error

    • You are not running the adb command-line tool from the directory its located in.
    • The adb path is not set in the .zshrc profile file.

Fix/Solution

    Make sure you are inside the location where adb tool is located.

    Example:
    % cd ~/Library/Android/sdk/platform-tools
    
    % ./adb version
    
    Android Debug Bridge version 1.0.41
    Version 34.0.4-10411341
    Installed as /Users/c2ctechtv/Library/Android/sdk/platform-tools/adb
    Running on Darwin 23.0.0 (arm64)

    Its better to add this path to the .zshrc file.

    1. Open .zshrc file.
      nano ~/.zshrc
    2. Add the below line to the zshrc file.
      export PATH="$HOME/Library/Android/sdk/platform-tools:$PATH"
      
    3. Control + X and Y followed by Enter to save changes to the file (if using Nano)
    4. Run source ~/.zshrc to apply changes
adb command working after adding PATH

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap