How to Obtain and Install ADB on a Mac

How to Obtain and Install ADB on a Mac

with 12 Comments

Android Debug Bridge (ADB) is a command-line tool that enables access to connected Android devices. This tutorial explains how to obtain and install ADB on a Mac. ADB is useful for accessing one or many connected devices (see the above photo).

Download the “SDK Platform-Tools for Mac” from:

https://developer.android.com/studio/releases/platform-tools

Unzip the downloaded file by double-clicking on it.

Move the unzipped folder (i.e., “platform-tools”) to a useful location (e.g., I put it in a folder called “android-sdk-macosx” in a folder called “SDKs” in my home directory: ~/SDKs/android-sdk-macosx/platform-tools/).

Add “platform-tools” to your PATH variable by invoking the following in the Terminal (make sure to change the file path to reflect where you placed the folder “platform-tools” on your system):

echo 'export PATH=$PATH:~/SDKs/android-sdk-macosx/platform-tools/' >> ~/.bash_profile

Execute the following command to reload your bash profile (this applies the change to the PATH variable):

source ~/.bash_profile

Note: The PATH variable is the search path for commands. It is a list of directories, each separated by a colon, in which the shell looks for commands. To see what values are currently in your PATH variable, use the following:

echo $PATH

To see if everything is working, connect an Android device and enter the following in the Terminal:

adb devices

It should return something like this (if you have one Android device attached):

List of devices attached
200804114c28b9e	device

Please note, to use ADB with an Android device connected over USB, you will need to enable USB debugging. See the section “Enable adb debugging on your device” at the following site:

https://developer.android.com/studio/command-line/adb

See:
https://stackoverflow.com/questions/31374085/installing-adb-on-macos

12 Responses

  1. Ahmed
    | Reply

    Thanks Bro

  2. Frankie
    | Reply

    Worked fine, out of all the guides found in Google this is the only one clear and concise.

    • Robin
      | Reply

      This worked for me. Many other guides didn’t.

      I needed to get a root shell using:-
      sudo -i
      before:-
      echo ‘export PATH:~/SDKs/android-sdk-macosx/platform-tools/‘ >> ~/.bash_profile

      Then:-
      echo $PATH
      worked after closing terminal and reopening (but not before, for me), and finally:-
      adb
      worked

  3. paul
    | Reply

    after inserting adb devices it writes “comand not found”
    MacBook-Air:~ paul$ cd /path/to/extracted/folder/
    -bash: cd: /path/to/extracted/folder/: No such file or directory
    MacBook-Air:~ paul$ echo ‘export PATH=$PATH:~/SDKs/android-sdk-macosx/platform-tools/’ >> ~/.bash_profile
    MacBook-Air:~ paul$ source ~/.bash_profile
    MacBook-Air:~ paul$ echo $PATH
    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/paul/SDKs/android-sdk-macosx/platform-tools/:/Users/paul/SDKs/android-sdk-macosx/platform-tools/:/Users/paul/SDKs/android-sdk-macosx/platform-tools/:/Users/paul/SDKs/android-sdk-macosx/platform-tools/:/Users/paul/SDKs/android-sdk-macosx/platform-tools/:/Users/paul/SDKs/android-sdk-macosx/platform-tools/
    MacBook-Air:~ paul$ adb devices
    -bash: adb: command not found
    MacBook-Air:~ paul$ adb devices

    • John
      | Reply

      After you unzipped “platform-tools” by double-clicking on it, where did you place the “platform-tools” folder? If you moved it somewhere different than what is outlined in the post, you will have to make sure you have the correct path to the “platform-tools” folder when you add it to the PATH variable.

      Just to be clear, in my home directory (the folder with the house on it), I created a folder called “SDKs,” and inside that folder I created another folder called “android-sdk-macosx,” and then I placed the unzipped, downloaded folder “platform-tools” in there.

      Hope that helps.

  4. paul
    | Reply

    thank you John
    I did all exactly what you said: But than I found, that mac has not installed the stuff for adb’s…..
    So I had to install Homebrew (http://stackoverflow.com/questions/17901692/set-up-adb-on-mac-os-x/19142768) It “did” a lot of work in terminal on my mac (sic?) not shure if its safe(lot of remote stuff)
    but it shows
    Homebrew is run entirely by unpaid volunteers. Please consider donating:
    http://github.com/Homebrew/brew#donations
    ==> Next steps:
    – Run `brew help` to get started
    – Further documentation:
    http://docs.brew.sh
    MacBook-Air:~ paul$ brew cask install android-platform-tools
    ==> Tapping homebrew/cask
    Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask’…
    remote: Enumerating objects: 3571, done.
    remote: Counting objects: 100% (3571/3571), done.
    remote: Compressing objects: 100% (3562/3562), done.
    remote: Total 3571 (delta 25), reused 456 (delta 7), pack-reused 0
    Receiving objects: 100% (3571/3571), 1.20 MiB | 613.00 KiB/s, done.
    Resolving deltas: 100% (25/25), done.
    Tapped 1 command and 3459 casks (3,576 files, 3.9MB).
    ==> Downloading http://dl.google.com/android/repository/platform-tools_r29.0.5-
    ######################################################################## 100.0%
    ==> Verifying SHA-256 checksum for Cask ‘android-platform-tools’.
    ==> Installing Cask android-platform-tools
    ==> Linking Binary ‘adb’ to ‘/usr/local/bin/adb’.
    ==> Linking Binary ‘dmtracedump’ to ‘/usr/local/bin/dmtracedump’.
    ==> Linking Binary ‘etc1tool’ to ‘/usr/local/bin/etc1tool’.
    ==> Linking Binary ‘fastboot’ to ‘/usr/local/bin/fastboot’.
    ==> Linking Binary ‘hprof-conv’ to ‘/usr/local/bin/hprof-conv’.
    ==> Linking Binary ‘mke2fs’ to ‘/usr/local/bin/mke2fs’.
    ? android-platform-tools was successfully installed!
    MacBook-Air:~ paul$ adb devices
    * daemon not running; starting now at tcp:5037
    * daemon started successfully
    List of devices attached
    7a5ac41d unauthorized…….no can you help me again John?

  5. pon
    | Reply

    i will go for it, thank you John

    • John
      | Reply

      Certainly.

  6. James
    | Reply

    GENIUS! Worked perfectly. Thank you!!!

  7. Hamza
    | Reply

    Thank you so much. This was really simple and straight-forward.

  8. Dan Otim
    | Reply

    Perfect perfect genius 👍 dude it worked after days of googling 😭

Leave a Reply