I spent quite sometime figuring how to set up adb on Mac, so I figure writing how to set it up might be useful to some people. adb is the command line tool to install and run android apps on your phone/emulator
-
1And here I thought "adb"is an old Unix debugger! ;) http://books.google.com/books?id=az-df5bhb1YC&pg=PA174&lpg=PA174&dq=%22adb%22+%22a+debugger%22+-android+%22unix%22&source=bl&ots=t-C4M7bv0b&sig=sI03zrFtNTDTksA1JBzGCasj9I4&hl=en&sa=X&ei=ymv0UbC-JY-r4AOcpIG4DA&ved=0CCwQ6AEwAA#v=onepage&q=%22adb%22%20%22a%20debugger%22%20-android%20%22unix%22&f=false – Eric Jul 28 '13 at 00:56
-
There is a link to the official `platform-tools` SDK package (which contains the `adb` binary) at http://stackoverflow.com/tags/adb/info – Alex P. Oct 17 '16 at 02:05
33 Answers
Note: this was originally written on Installing ADB on macOS but that question was closed as a duplicate of this one.
Note for zsh users: replace all references to ~/.bash_profile
with ~/.zshrc
.
Option 1 - Using Homebrew
This is the easiest way and will provide automatic updates.
Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Install adb
brew install android-platform-tools
or try a cask install depending on your settings:
brew install --cask android-platform-tools
Start using adb
adb devices
Option 2 - Manually (just the platform tools)
This is the easiest way to get a manual installation of ADB and Fastboot.
Delete your old installation (optional)
rm -rf ~/.android-sdk-macosx/
Navigate to https://developer.android.com/studio/releases/platform-tools.html and click on the
SDK Platform-Tools for Mac
link.Go to your Downloads folder
cd ~/Downloads/
Unzip the tools you downloaded
unzip platform-tools-latest*.zip
Move them somewhere you won't accidentally delete them
mkdir ~/.android-sdk-macosx mv platform-tools/ ~/.android-sdk-macosx/platform-tools
Add
platform-tools
to your pathecho 'export PATH=$PATH:~/.android-sdk-macosx/platform-tools/' >> ~/.bash_profile
Refresh your bash profile (or restart your terminal app)
source ~/.bash_profile
Start using adb
adb devices
Option 3 - If you already have Android Studio installed
Add
platform-tools
to your pathecho 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile echo 'export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"' >> ~/.bash_profile
Refresh your bash profile (or restart your terminal app)
source ~/.bash_profile
Start using adb
adb devices
Option 4 - MacPorts
Install the Android SDK:
sudo port install android
Run the SDK manager:
sh /opt/local/share/java/android-sdk-macosx/tools/android
Uncheck everything but
Android SDK Platform-tools
(optional)Install the packages, accepting licenses. Close the SDK Manager.
Add
platform-tools
to your path; in MacPorts, they're in/opt/local/share/java/android-sdk-macosx/platform-tools
. E.g., for bash:echo 'export PATH="$PATH:/opt/local/share/java/android-sdk-macosx/platform-tools"' >> ~/.bash_profile
Refresh your bash profile (or restart your terminal/shell):
source ~/.bash_profile
Start using adb:
adb devices
Option 5 - Manually (with SDK Manager)
Delete your old installation (optional)
rm -rf ~/.android-sdk-macosx/
Download the Mac SDK Tools from the Android developer site under "Get just the command line tools". Make sure you save them to your Downloads folder.
Go to your Downloads folder
cd ~/Downloads/
Unzip the tools you downloaded
unzip tools_r*-macosx.zip
Move them somewhere you won't accidentally delete them
mkdir ~/.android-sdk-macosx mv tools/ ~/.android-sdk-macosx/tools
Run the SDK Manager
sh ~/.android-sdk-macosx/tools/android
Uncheck everything but
Android SDK Platform-tools
(optional)Click
Install Packages
, accept licenses, clickInstall
. Close the SDK Manager window.Add
platform-tools
to your pathecho 'export PATH="$PATH:~/.android-sdk-macosx/platform-tools/"' >> ~/.bash_profile
Refresh your bash profile (or restart your terminal app)
source ~/.bash_profile
Start using adb
adb devices
-
27
-
3this is far more straightforward than chasing down the sdk path which keeps changing. – Tyler Zale May 11 '16 at 18:45
-
1
-
For create file if not available perform with terminal $Touch .bash_profile For open and edit file $open -e .bash_profile in file type it export JAVA_HOME=$(/usr/libexec/java_home) export ANDROID_HOME=/Users/user_name/Library/Android/sdk export PATH=$ANDROID_HOME/platform-tools:$PATH export PATH=$ANDROID_HOME/tools:$PATH then file>save After restart Terminal app and enjoy. – Prags Nov 08 '17 at 13:16
-
Option 1 worked fastest and smoother. Can I give you an award for saving my time :) Thanks! – Rohan Feb 22 '18 at 21:20
-
please consider editing your post to rearrange the options order. as it currently stands it seem to suggest that using `homebrew` is the recommended option. it may be the easiest option to install but for a novice developer it should be skipped in favor of the official Google binaries (options #2 and #3) – Alex P. Jun 16 '18 at 18:47
-
If you already have android studio installed, option 1 is not a solution as android studio updates faster than android-platform-tools on android. There will be a mismatch and it won't run correctly. – kemicofa ghost Jun 20 '18 at 08:32
-
Option 3. Note that you need to have downloaded AND installed AND ran Android Studio (for the first time), for it to install the SDK Tools. If you had just downloaded (the dmg) or just downloaded and installed but not run, then the SDK Tools will not be present (yet), until you run it for the first time. – therobyouknow Jan 16 '19 at 11:14
-
4I already have Android studio so I tried 3. It works after I run source ./bash_profile but only persists as long as the terminal is open. – bikram Mar 27 '20 at 16:15
-
@Bikram you need to make sure ./bash_profile is always run when your terminal starts up. See https://apple.stackexchange.com/questions/12993/why-doesnt-bashrc-run-automatically – brismuth Mar 28 '20 at 18:28
-
Yes! This! Thank you! Why is this not done by default when using Android Studio? Jeez, there are so many additional unnecessary steps just to get a functioning environment! – reukiodo Jul 12 '20 at 15:47
-
3
-
echo 'export PATH=$PATH:~/Users/abc/Library/Android/sdk/platform-tools/' >> ~/.bash_profile worked for me, thanks – Harish Gyanani Mar 25 '21 at 07:52
-
Hi! I have android studio on Mac, I have ANDROID_JOME setup on zhrc but none of this work. adb command is still not found. can someone please help me. – SMDC Jul 27 '22 at 13:48
-
@SMDC is that a typo or are you actually putting in ANDROID_JOME instead of ANDROID_HOME? – brismuth Jul 27 '22 at 18:24
echo "export PATH=\$PATH:/Users/${USER}/Library/Android/sdk/platform-tools/" >> ~/.bash_profile && source ~/.bash_profile
If you put the android-sdks folder in other directory, replace the path with the directory android-sdks/platform-tools is in

- 7,426
- 2
- 37
- 71

- 18,606
- 9
- 28
- 34
-
69And for those who use `zsh` instead bash, you'll need to add this to `~/.zshrc` – Gianfranco P. Sep 05 '13 at 01:17
-
15You've also gotta Quit and reopen your Terminal for the changes to take effect – amadib Feb 08 '14 at 01:07
-
38As of Android Studio 1.0 Location of platform tools is echo 'export PATH=$PATH:/Users/[yourusername]/Library/Android/sdk/platform-tools' >> ~/.bash_profile – user1401250 Dec 16 '14 at 06:50
-
13No need to quit and reopen the Terminal, you can just `source ~/.bash_profile`. – Nighto Apr 13 '15 at 01:46
-
-
10
-
3This is a horrific answer as it nukes everything else in your bash_profile – shepsii Jun 16 '17 at 14:34
-
1For other fools ;) who might copy and paste that escaped text directly into their .bash_profile and then wonder where the heck the `which` and other basic commands went after reloading the shell (`source ~/.bash_profile`) : that should read as `export PATH=$PATH:/Users/${USER}/Library/Android/sdk/platform-tools` – Alex Hall Nov 21 '17 at 01:06
-
Only for zsh users in Terminal or iterm2 in macOS
type the following two commands to add the android sdk and platform-tools to your zsh in Terminal or iterm2 in macOS
echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.zshrc
echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.zshrc
After adding the two command to ~/.zshrc
you need to source the zsh.
source ~/.zshrc

- 424
- 4
- 17

- 2,011
- 1
- 15
- 18
-
4This is what I was looking for! :) Thanks! Also, don't forget to run source .zshrc or reopen terminal. :D – rafaelbpa Aug 23 '19 at 16:51
-
You are welcome. edited the answer and add a source to zsh command. – Akarsh SEGGEMU Oct 31 '19 at 12:11
-
-
1works like a charm on the M1 mac! thank you! I wasn't aware of the zsh and bash thing are now updated. used mac after like 4 years! – sud007 Jul 17 '21 at 12:06
-
2
-
@sud007 Hello, I am having trouble to run ./adb from terminal with M1 chip, i have followed all the steps and solutions but stil no change, can you please explain how you got it? – Ulugbek Jan 30 '22 at 10:36
-
@Ulugbek, I just followed the steps and it just worked fine for me. Did you make sure that you set the right path for `$user/Library` and also have you set your `ANDROID_HOME` as well prior to trying this? – sud007 Jan 31 '22 at 08:19
-
this is how it works, because when we use homebrew then bash is not the solution – Lakhwinder Singh Jun 03 '22 at 11:39
This Works Flawless....
In terminal Run both commands next to each other
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

- 4,795
- 15
- 19

- 1,141
- 1
- 7
- 7
-
2I can confirm that this works great as of June 2017 on macOS Sierra. – Vahid Amiri Jun 02 '17 at 20:31
-
`sdk` folder has been removed. If those two commands were run, `adb devices` won't work. Should be the following for latest android studio ` export ANDROID_HOME=/Users/$USER/Library/Android export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools ` – Liangjun Jun 05 '17 at 02:17
-
Thanks its help me but make sure change after $USER path with your directory of sdk – abadooz Oct 30 '18 at 08:22
-
1As of android studio 3.2, the path is defaulted to '$HOME/Library/Android/sdk' – tsalaroth Nov 03 '18 at 11:02
-
-
Only solution that helped me and was easy to do. Works on MacOS Big Sur. end of 2020! – Vlad Pylyp Nov 19 '20 at 13:30
-
On Big Sur....uh...was running these commands supposed to make `adb devices` be globally recognized in terminal? Because it didn't. I have Android Studio installed. Closed and opened a new Terminal window. – velkoon Sep 28 '21 at 21:30
2022 Solution
If you have Android Studio installed already and Terminal isn't picking up ADB, here's a one-liner that should fix it:
sudo ln -s ~/Library/Android/sdk/platform-tools/adb /usr/local/bin
It creates a symbolic link (essentially a shortcut) for the adb
executable. It's added to /usr/local/bin
which is one of the default locations where Terminal looks for command line tools.

- 8,437
- 8
- 49
- 80

- 1,605
- 14
- 18
-
Could you explain what happens in this? what is `ln` and `-s`? – Roshana Pitigala Nov 10 '22 at 10:20
-
2It creates a symbolic link (essentially a shortcut) for the adb executable. It's added to /usr/local/bin which is one of the default locations where Terminal looks for command line tools. – Lorenzo Nov 11 '22 at 05:12
-
NOTE: Path for adb has changed since Android Studio 1.0.xx
For bash shell, use:
echo 'export PATH=$PATH:'$HOME'/Library/Android/sdk/platform-tools' >> ~/.bash_profile
For tcsh shell, use:
echo 'setenv PATH $PATH\:'$HOME'/Library/Android/sdk/platform-tools' >> ~/.tcshrc
-
-
2
-
Command for bash shell and Eclipse is echo 'export PATH=$PATH:/Applications/adt-bundle-mac-x86_64/sdk/platform-tools/' >> ~/.bash_profile – YoungDinosaur Feb 18 '15 at 00:51
-
2Android Studio 2.0 and that's still the location - `~/Library/Android/sdk/platform-tools` – galdin Apr 18 '16 at 08:02
If you are using zsh shell
and after trying all this solutions, you still need to set $PATH
and $ANDROID_HOME
every time you open new terminal instance, then here is your answer:
step 1: in terminal run nano ~/.zshrc
step 2: paste following command at the end of the file
export ANDROID_HOME=~/Library/Android/sdk
export PATH=$ANDROID_HOME/platform-tools:$PATH
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/tools/bin:$PATH
step 3: After copying the lines above, to save hit control + X. and to confirm hit Y. It will ask you if you wish to change the file name but don't change the name so directly hit enter
step 4: Restart your terminal and execute the adb command.
Bingo!

- 3,336
- 2
- 25
- 41

- 1,762
- 1
- 16
- 29
-
1You might want to use this to be user name independent: export ANDROID_HOME=~/Library/Android/sdk – Michael Troger Dec 15 '21 at 10:07
-
@MichaelTroger well said, I've updated the answer with your help! thanks – Keval Langalia Dec 16 '21 at 19:50
-
To avoid conflicts with vscode use this solution in macos 11 or higher. https://stackoverflow.com/a/72206562/7621800 – Atish Shakya Nov 01 '22 at 10:59
Here is a step wise information :
Step-1
Start up Terminal and go to your home folder.
cd ~/
Step-2
Open and edit .bash_profile file
$ open -e .bash_profile
If you don’t have .bash_profile file in your computer path, then create one. Enter below command to create a new file. Once created follow Step-2.
touch .bash_profile
Step-3
Save the below line)
export PATH=${PATH}:/Applications/adt-bundle-mac-x86_64-20140321/sdk/tools
export PATH=${PATH}:/Applications/adt-bundle-mac-x86_64-20140321/sdk/platform-tools
Step-4
Refresh the file using below command
$ source .bash_profile
$ echo $PATH
You should see your android path set in the output now.

- 1,978
- 1
- 15
- 7
Personally I just source my .bashrc in my .bash_profile:
echo 'source ~/.bashrc' >> ~/.bash_profile
So I put it in my .bashrc. And I'm using Android Studio, so it was a different path.
echo 'PATH=$PATH:$HOME/Library/Android/sdk/platform-tools/' >> ~/.bashrc
You may also want the following:
echo 'ANDROID_HOME=$HOME/Library/Android/sdk' >> ~/.bashrc

- 35,925
- 7
- 54
- 59
The simplest way to use adb command on your Mac systems would be to add the path to the platform-tools (where adb lives) into your bash_profile.
Steps to add the adb path: 1. open the bash_profile: This can be done by using the following commands
open ~/.bash_profile
This opens up the bash_profile in an editor.
Locate the platform_tools, usually they are present at the following location: Users/"user_folder"/Library/Android/sdk/platform_tools
Paste the following command in the bash_profile file which opens up:
export PATH=$PATH:/Users/A374375/Library/Android/sdk/platform-tools
Save the file using the command:
source ~/.bash_profile
Check if the path is saved by typing:
echo $PATH
: You should be able to find the entire path displayed in the output.Type
adb
to see if the configuration worked. If you have any devices connected to the machine or any emulators running on your system they would be displayed when you typeadb devices

- 313
- 2
- 6
For Mac users : Step 1: Install the Android Studio
Step2 : Open the terminal and type
cd
Step 3: Type below mentioned command changing the userName:
export PATH=“/Users/{user_name}/Library/Android/sdk/platform-tools”:$PATH

- 873
- 10
- 24
On MacOS Big Sur do the following:
Open config file:
nano ~/.zshrc
Add paths to PATH variable:
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
close file and save changes. Then in terminal write:
source ~/.zshrc
And then you'll be able to run:
adb devices
adb kill-server

- 4,644
- 14
- 65
- 98
cd sdk/platform-tools/
and then use ./adb devices
instead

- 19,893
- 17
- 73
- 130

- 161
- 1
- 2
-
3I have to be inside `/Users/ashokr/Library/Android/sdk/platform-tools` and then it works. – Ashok R Feb 09 '18 at 19:57
If you using zsh then you need do the add the following to your .zshrc
Steps: Step 1: Open your .zshrc profile
open -e .zshrc
Step 2: Add the following to the file
export PATH=$PATH:/Users/${YourUser}/Library/Android/sdk/platform-tools
export ANDROID_HOME=/Users/${YourUser}/Library/Android/sdk
Step 3: Save the file and close. Step 4: Reload the .zshrc
source .zshrc
Step 5: Check the devices connected
adb devices

- 2,743
- 3
- 11
- 7
This solution is for Mac:
Considering you have already downloaded SDK platform tools & trying to set adb path:
If you want to check the SDK is available or not, just check it by following this path:
User > Library (Hidden folder) > Android > sdk > platform-tools > adb
To set the PATH for the adb command on a macOS system, firstly need to edit your shell configuration file. The default shell on macOS is Bash or Zash.
If you're using Bash, so you will need to edit the ~/.bash_profile file otherwise edit ~/.zprofile in your home directory.
Here's how to do it:
By Terminal:
- Open a terminal window and enter the following command:
nano ~/.bash_profile
or
nano ~/.zprofile
This will open the ~/.bash_profile or ~/.zprofile file in the Nano text editor.
- Add the following line to the file:
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
Press Ctrl+X
to exit the Nano editor, then press Y
to save the changes and Enter
to confirm the filename.
- Run the following command to reload your shell configuration:
source ~/.bash_profile
or
source ~/.zprofile
After you have set the PATH for adb, you should be able to run the adb command from any terminal window.
By Manual:
- Go to the
Home
directory & tapcommand
+shift
+.
(To show the hidden files)
- Search file ~/.bash_profile or ~/.zprofile & open it.
- Add required path & save it.
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
- Run the following command to reload your shell configuration:
source ~/.bash_profile
or
source ~/.zprofile
After you have set the PATH for adb, you should be able to run the adb command from any terminal window.

- 870
- 5
- 20
if you are using Android Studio in MAC OS X , you could exec the following command in your terminal app:
echo 'alias adb="/Applications/Android\ Studio.app/sdk/platform-tools/adb"' >> .bashrc
exec $SHELL
and next:
adb devices
and you should be showing a list with your android devices connected via USB cable in your MAC, for example something like this:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
deb7bed5 device

- 2,348
- 1
- 13
- 12
-
1Can you just clarify what the exec $SHELL line does exactly? Newb here, never used that in a terminal before! :) – John Shelley Oct 13 '14 at 20:46
-
I run this command, because after edit the '.basrc' is necessary that restart the command line, and with this command you can restart without to close the terminal window – trejo08 Oct 15 '14 at 21:00
MAC Solution.
cd /Users/<user>/Library/Android/sdk/platform-tools
./adb devices

- 806
- 11
- 10
For macOS Users Updated to MacOs Catalina,
~/.bash_profile changed to ~/.zshrc
So ,to run adb command and all other commands already exported to ~/.bash_profile easy walkaround is to export bash_profile to zshrc
To do that,
1) Navigate to the home directory in finder
2) I used Cmd + Shift + . to show the hidden files in Finder
3) Create .zshrc file if already not exist
4) Add line "source ~/.bash_profile" without quotes
5) Save
6) Quit and open terminal
start using adb devices

- 2,393
- 2
- 25
- 30
-
This, in combination with this solution: [ https://stackoverflow.com/a/58387314/3511695 ] finally seemed to work. Geeeeze. Thanks. – velkoon Sep 28 '21 at 21:38
Here's a detailed manual:
http://codexpi.com/add-android-adb-path-mac-os-x-mavericks/
To sum this up:
Create and open the bash_profile file
touch .bash_profile
open -e .bash_profile
Add the path of the platform-tools folder (within the Android SDK)
export PATH="$PATH:/Users/USERNAME/PATH TO ANDROID SDK/platform-tools/
Run the command
. .bash_profile
to update (no need to restart the terminal)

- 141
- 1
- 10
If you are using ZSH and have Android Studio 1.3:
1. Open .zshrc file (Located in your home directory, file is hidden so make sure you can see hidden files)
2. Add this line at the end: alias adb="/Users/kamil/Library/Android/sdk/platform-tools/adb"
3. Quit terminal
4. Open terminal and type in adb devices
5. If it worked it will give you list of all connected devices

- 181
- 2
- 4
Mac OS Open Terminal
touch ~/.bash_profile; open ~/.bash_profile
Copy and paste:
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
command + S for save.

- 3,553
- 30
- 28
-
Still getting `zsh: command not found: adb` after opening a new terminal window. EDIT: I just had to follow these steps afterwards: [ https://stackoverflow.com/a/59243688/3511695 ] – velkoon Sep 28 '21 at 21:36
If you are setting the path in Catalina use below command one after another in the terminal. It's working fine for me.
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
source ~/.bash_profile

- 3,539
- 2
- 28
- 26
Commenting with some updated information from 2018.
Executable Binaries for Platform tools are made available for mac by Android here: https://developer.android.com/studio/releases/platform-tools.html
Download these to your mac. Place them in a directory e.g. I placed in ~/Software/platform-tools
If you have root access, the easiest way I have found on a mac is to add your directories to the list in /etc/paths
. I like this way because after a few additions the $PATH
starts to look too messy and hard to read, the /etc/paths
has everything in separate line, clean and organized. The downside is that you require root access.
$ cat /etc/paths # check contents of the file
$ sudo nano /etc/paths
Paste the full path of your platform-tools directory (something like /Users/GodZilla/Software/platform-tools/adb
) at the end of this list and save. Quit and Open terminal again and check if it sees your platform-tools directory.
$ which adb
/Users/GodZilla/Software/platform-tools/adb
$ which fastboot
/Users/GodZilla/Software/platform-tools/fastboot
If you don't have root access, just add the platform-tools directory to $PATH
in your .bash_profile (or .zshenv if you use zsh) as other users have suggested.

- 81
- 2
Download Android Platform Tools for macOS from:
https://developer.android.com/studio/releases/platform-tools
Extract to your somewhere e.g ~/installs/platform-tools
Add that folder to path by running:
echo 'export PATH=$PATH:~/installs/platform-tools' >> ~/.zshrc
Either restart terminal or run:
source ~/.zshrc
Assuming that you are using zsh.

- 4,769
- 6
- 36
- 45

- 950
- 12
- 21
This totally worked for me, after dickering around for a while after installing Android Studio:
Make sure you have the .bash_profile file. This should be in your [username] directory.
From whatever directory you are on, type this:
echo "export PATH=\$PATH:/Users/${USER}/Library/Android/sdk/platform-tools/" >> ~/.bash_profile
Now, usually you will have this exact path, but if not, then use whatever path you have the platform-tools folder
From the directory where your .bash_profile resides, type this:
. .bash_profile
Now type
adb devices
. You should see a "List of devices attached" response. Now you do not have to go to the platform-tools directory each and every time to type in the more cryptic command like,./adb devices
!!!

- 9,932
- 6
- 52
- 48

- 29
- 1
-
it's a little easier to read for a newbie I think. maybe it could be added to the other? – AnneTheAgile Dec 08 '16 at 22:53
In my case, I installed Android studio, and have some apps (rust lang) that changes the ~/.profile
, and adding adb
to ~/.bash_profile
made the rust un-executable, so I made the changes to the ~/.profile
only, as:
$ echo 'PATH=$PATH:$HOME/Library/Android/sdk/platform-tools/' >> ~/.profile
$ source ~/.profile
$ adb --version
Android Debug Bridge version 1.0.41
Version 29.0.4-5871666
Installed as /Users/hasan/Library/Android/sdk/platform-tools/adb

- 22,789
- 24
- 132
- 203
In my case : I did the following (on a mac) :
- backed up the ".bash_profile" and ".profile"
- cleared all the android related paths.
- created the new paths but this time around, I dragged the respective folders : { /.../sdk, /.../tools, /.../platform-tools } into the terminal. I did this for both ".bash_profile" and ".profile".
- Then after successfully saving the files each. I restarted the terminal just to be sure about the modifications I made.
- I then went on to test if adb was responding now ... by typing : (in terminal) adb devices
- I still had no luck (my devices) where not showing, then I restarted the adb, still.
- I went on to do "android update adb" . This just killed and restarted the adb
- I tried again still the devices wasnt showing.
- I totally backed up my android device and resetted the whole phone back to factory default, went over to activate the device for development and allow for usb debugging in its settings > applications.
******** WORKED LIKE A CHARM ********
I tried again with the command "adb devices" and everything was back to normal the device was visible.
All the best. Just dont give up. It took me a lot of troubleshooting. All the best of luck.

- 144
- 1
- 6
Considering you have already downloaded SDK platform tools.
This command will set ADB locally. So if you close the terminal and open it again, ADB commands won't work until you run this command again.
export PATH=~/Library/Android/sdk/platform-tools:$PATH
These commands will set ADB globally. So once you run these commands no need to set them again next time.
echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools/' >> ~/.bash_profile
source ~/.bash_profile

- 1,534
- 1
- 17
- 27
If you are using zsh terminal do the following:
1) Open .zprofile file with the editor of your choice like "open -a xcode ~/.zprofile"
2) Add new PATH or Env Variable in .zprofile Save the file and quit the editor.
3) Execute your .zprofile to update your PATH: source ~/.zprofile

- 590
- 1
- 7
- 21
Add environment variable for Android Home Targetting Platform Tools
echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile
echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.bash_profile
Restart Bash
source ~/.bash_profile
Now Check adb
Simply type
adb
on terminal
After trying all the solutions, none of them where working for me.
In my case I had the Android Studio and the adb was correctly working but the Android Studio was not capable to detect the adb. These was because I installed it with homebrew in another directory, not the /Users/$USER/Library/Android/sdk but Usr/Library blabla
Apparently AS needed to have it in his route /Users/$USER/Library/Android/sdk (same place as in preferences SDK installation route)
So I deleted all the adb from my computer (I installed several) and executed these terminal commands:
echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile
echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.bash_profile
source ~/.bash_profile
adb devices
Well, after that, still wasn't working, because for some reason the route for the adb was /Users/$USER/Library/Android/sdk/platform-tools/platform-tools (yes, repeated) so I just copied the last platform-tools into the first directory with all the license files and started working.
Weird but true

- 1,632
- 16
- 30
MacPorts
It seems like android-platform-tools
was first added to MacPorts only very recently — in 2018-10-20, under java/android-platform-tools/Portfile
:
- https://www.macports.org/ports.php?by=name&substr=android
- https://github.com/macports/macports-ports/blob/master/java/android-platform-tools/Portfile
- https://github.com/macports/macports-ports/commit/7fde64249deb97c97edb37699f1ee8076c98d41a#diff-f03a90b4adeb82935eb39763ecd988f2
It would appear that it relies on a compiled binary that's provided by Google; it would appear that the source code for the binary might not be available.
The adb
binary
Reverse-engineering the android-platform-tools/Portfile
from above reveals that the following archive is fetched from Google in order to build the port:
The abd
binary is pre-compiled, available in platform-tools/adb
within the above archive, which is a Mach-O 64-bit executable x86_64
, as per file(1)
. It's ready to be used and doesn't seem to have any external dependencies (e.g., doesn't look like it depends on java or anything).
Using adb
In order to use adb
to restart the device, for example, in case the power button is stuck, the following steps could be used:
cd /tmp
curl https://dl.google.com/android/repository/platform-tools_r28.0.1-darwin.zip -o apt.zip
unzip apt.zip
./platform-tools/adb devices
./platform-tools/adb reboot
Upon first use since a reboot, you also have to first confirm the pairing with the phone through the Allow USB debugging? popup on the phone (phone has to have USB debugging enabled through the Developer Options, no root access required).

- 25,870
- 6
- 90
- 122
Step 1 : Open Terminal
Step 2 : Run command :
touch ~/.bash_profile; open ~/.bash_profile
Step 3 : This will open textEdit file when you can add following command:
export PATH=$PATH:/Users/sharan/Library/Android/sdk/platform-tools
Blockquote
Note : sharan is my user name check that on y our system and replace that with sharan rest will be same. You can also find that by opening android studio
File->Project Structure..->SDK Location
Under Android SDK location there is path of sdk copy that and paste that on file and save it by pressing Command+S

- 1
- 3