How to set up ADB (Android Debug Bridge) in Mac OSX

I have seen many questions regarding the set up of ADB under Mac OSX, and when I got myself a MBP I had the same question. After some research, I was able to find that is not as complicated as I thought it would be; it’s actually less of a hassle than setting it up under Windows or Linux. In OSX, ADB just works, as simple as that.

What is ADB?
ADB (Android Debug Bridge) is a handy tool that comes with Android SDK that allows you to control and interface with your Android device.

Update: 06/23/17 – Updated steps in How To

Update: 08/06/13 – In step 5.2, Android 4.2.x and up has Developer Options hidden. Added steps to make it visible
Update: 5/21/13 – Updated platform-tools (ADB) to latest version (Revision 14)
Update: 12/11/10 – There has been a change to the new Android SDK. ADB Tool has been moved to /android-sdk-mac_86/plataform-tools, so if you have the old SDK, please download the new one and update your path (Step 4.5 of this tutorial). If this is your first time doing this, then disregard the update and continue with the tutorial.
Update: 10/22/10 – Found solution for Galaxy S phones with newer Macs.
Update: 10/14/10 – There are issues connecting Galaxy S phones with newer Macs. Go to the end of the tutorial to see possible solutions.

The How To

  1. Download the latest Android SDK from Google: Android SDK
  2. Extract the ZIP file to your desired location
  3. To get ADB, you need to install the SDK: Installing the SDK
    • If you are not a developer and not planning to develop, then just download the following zip file containing only the ADB tool and proceed with the tutorial: ADB
  4. Download the SDK Platform Tools for Mac and extract the zip file.
  5. Create an environment variable (Optional)
    • Open Terminal
    • Type cd ~ this will take you to your home directory
    • Type touch .profile this will create a hidden file named profile
    • Type open -e .profile this will open the file you just created in TextEdit
    • In the file, type export PATH=${PATH}:/pathToTheAndroidSdkFolder/android-sdk-mac_86/platform-tools
    • Save file, close TextEdit, Quit Terminal, and Relaunch Terminal
    • NOTE: By creating an environment variable you won’t need to cd to the Android/tools folder every time you want to run ADB
  6. You are good to go, type in terminal adb devices, this should give you a serial number, which corresponds to your phone. Looks something like this:
    List of devices attached
    HT99PHF02521 device

    • NOTE: If you did not create an environment variable, then cd to the platform-tools folder, then type ./adb devices
    • Also make sure you have your phone plugged in and have Android Debugging turned on (Settings > Developer Options > Android Debugging)
      • In Android 4.2.x and up Developer Options is hidden, to make it visible, do the following
      • Tap seven times in Build Number: Settings > About Phone > Build Number
      • You will get a message saying you have enabled Developer Options or something like that, go back to Settings and you will see Developer Options in there.

Connecting Galaxy S phones

A couple of days back I got a Galaxy S phone (Epic 4G) and was excited about the phone until I tried to connect it to my Mac, to my surprise, the phone wouldn’t connect, nor Mounting the phone as USB Mass Storage, nor thru ADB; I was disappointed. I rushed to Google trying to find an answer and to my surprise, I wasn’t the only one having the same problem, some people only connected for a couple of seconds then OSX would kick them out, some others wouldn’t connect al all, and some other ones connected just fine. Digging deeper I found several solutions:

  • Make sure you have USB Debugging turned on in your phone (/Settings/Applications/Development/USB Debugging)
  • Try restarting the phone and changing USB ports
  • Try a different USB cable, the one out of the box is not so good
  • Try connecting the phone thru a powered USB Hub

Personally, I have tried them all, with the exception of the powered USB Hub, and none of them have worked. I bought two USB cables, one from RadioShack and the other one from Sprint Store, neither worked, the only one that has worked is the one provided, but just for a couple of seconds, then it kicks me out. 🙁

It seems that either the Mac of the phone requires more power, so the last option (powered USB hub) seems the best one, I’ll be buying one soon and report back to you guys with the results.

One last note, I connected my phone to a previous generation Mac and it worked like a charm, so I guess the problem is only with newer Macs. What a bummer!!!

Update: So I bought a cheap $10 bucks powered USB Hub from eBay, plugged my phone thru it and worked at first try, amazing!! If you have a 5th gen Mac and a Galaxy S Phone, then the solution to connect your device is thru a powered USB Hub. Happy Modding 🙂

Note: This ONLY happens to Galaxy S phones, every other device should connect just fine.

Common ADB Commands

– Lists which devices are currently attached to your computer

adb devices

– Drops you into a basic linux command shell on your phone with no parameters, or lets you run commands directly

adb shell

– Lets you install an Android application on your phone

adb install

– Remounts your system in write mode – this lets you alter system files on your phone using ADB

adb remount

– Rets you upload files to your phones filesystem

adb push

– Lets you download files off your phones filesystem

adb pull

– Starts dumping debugging information from your handset to the console – useful for debugging your apps

adb logcat

If you liked this tutorial, please retweet and/or share 🙂



 

Esau Silva
Software Engineer at Region One ESC
Full Stack Software Engineer working with Microsoft technologies, ReactJS is awesome and avid Brazilian Jiu-Jitsu practitioner
Spread the love

88 thoughts on “How to set up ADB (Android Debug Bridge) in Mac OSX

  1. Esau Silva says:

    New Post: How to set up ADB (Android Debug Bridge) in Mac OSX http://bit.ly/c7eDGV #ADB #OSX #Mac #Android

  2. TB says:

    I’m seeking some guidance on this. I found your post through a link on theunlockr.com. I’m trying to add ADB so that I can load a custom ROM on my T-Mobile G1.

    I’m struggling in getting my phone’s serial number to display. I am relatively new to this, so I am sure I am making an error along the way. I have tried the process on both my MacBook and on an XP loaded Windows machine.

    I’ve also tried it on my MacBook and I can’t get it to show me my serial number. I’m appreciative of any help you can provide. My email address is tbryan09@gmail.com.

    Thanks!

    TB

    • jgezau says:

      On the MacBook, did you create the environment variable as I stated in the post? Remember, the environment variable is optional, but is better to have it. If you did not create it, then what you need to do is locate the folder named “Tools” under your Android SDK folder, navigate into that folder thru a Terminal window, (just in case you do not know how to use Terminal Window, take a look at this blog http://www.ehow.com/how_2138457_command-line-mac-using-terminal.html) . Once you are inside “Tools” folder, then type in Terminal window ./adb devices and it should give your phone’s the serial number … I suggest creating an environment variable because you won’t need to navigate to the Android Folder every time you want to adb. Let me know if you have more questions. Thanks

  3. Esau Silva says:

    RT @TopsyRT: How to set up ADB (Android Debug Bridge) in Mac OSX http://bit.ly/ck4qoW

  4. Esau Silva says:

    @GalaxySsupport Yes, USB Debugging is checked. A lot of ppl are having the same problem (I read forums). Read my blog http://bit.ly/ck4qoW

  5. skube says:

    The PATH thing didn’t work until I made the shell reload the .profile by typing:
    . ./.profile

  6. […] Player with FM Radio (Black) Help! Trouble Rooting Using Unrevoked/Gold Card Tool – Android Forums How to set up ADB (Android Debug Bridge) in Mac OSX « Esau Silva How to share files/printer between XP PC & Windows 7 laptop on a working N-broadband – PCMech […]

  7. Just to let all of you know – in the latest SDK (2.3) the adb tool has been moved from the tools directory into the platform-tools directory. You will want to update your .profile $PATH export to include the platform-tools as well.

  8. NotShy says:

    Can you please update the guide as I think there is something key missing.

    Once you have edited the “.profile” in TextEdit – you need to save and exit TextEdit and then you also NEED TO QUIT TERMINAL. Then when you reload Terminal it re-reads the path’s in the .profile

    I stuggled for this for a long time and only found it worked when I relaunched Terminal.

    I hope this helps.

  9. How to set up ADB (Android Debug Bridge) in Mac OSX http://t.co/OKHrvNk

  10. Daveed says:

    I have been trying to get my HTC G1 running 2.1-update1 to show my phone’s serial number, but the list of devices from adb continues to be blank. The phone doesn’t show up in doubleTwist either. I have turned on USB debugging and changed USB ports to no avail. Restarting the phone and killing then restarting the adb server doesn’t help either. What else can I do?

  11. RT @TopsyRT: How to set up ADB (Android Debug Bridge) in Mac OSX http://bit.ly/ck4qoW

  12. Ronaldo says:

    Hi,

    Thanks very much, works like charm even with the Samsung Galaxy S. Your post saved me a lot of time.

  13. Rebecca Roth says:

    @JGeZau saved my day! His post was EXTREMELY helpful when it came to setting up Android Debug Bridge http://bit.ly/f37ZvJ #Mac #Andorid

  14. […] How to set up ADB (Android Debug Bridge) in Mac OSX […]

  15. DroidVicious says:

    Ayo what up kid.. Very nice info!! I’m a Linux guy for the past 2 years and Windows before that and I decided to pick up a Mac for fun and setting up adb posed to be a challenge at first as I searched and searched for info on setting it up and not much made enouh sense to properly set it up… I mean downloading the sdk and adding adb not a problem and the easy route by cd’ing to platform-tools not a problem, but the whole path was getting to me lol…. I came across your post and this time actually made some sense and it turns out that Mac is actually very very similar to Linux!!!! Anyways, thanks a bunch this is good info you got here. I’m book marking this page so if I come across anyone who needs Mac help I will refer to this page!!!!

  16. Alexis Wach says:

    RT @TopsyRT: How to set up ADB (Android Debug Bridge) in Mac OSX http://t.co/LP5zskV

  17. Gavin James says:

    RT @TopsyRT: How to set up ADB (Android Debug Bridge) in Mac OSX http://t.co/4tNpdKQ

  18. Seraphim says:

    Hello and thanks for all the hard work on this project. I went through the programming exactly as you wrote twice (including creating an environment variable). When I got through it all and saved and closed txt edit, then quit terminal I reopened another terminal and typed ” adb devices” and got this:
    Last login: Thu Jun 23 05:16:19 on ttys000
    [Matthew-Allen-Bowen:~] mattrn% abd devices
    abd: Command not found.

    Please advise and thank you so much. BTW running Mac OS X 10.6.7 on Dual Core 2.0GHz MacBook (Black)

    • jgezau says:

      Did you copy and paste this exactly from terminal?
      ” [Matthew-Allen-Bowen:~] mattrn% abd devices
      abd: Command not found. ”
      Because if you did, then it’s misspelled. The command is supposed to be “adb devices” not “abd devices”

  19. 1234 says:

    hello i have followed your exact steps, however when i type adb devices it says command bot found and i have already created the environment.

    • jgezau says:

      That is weird. Did you type the path to the AndroidSdk folder correctly when creating the environment variable. You might wanna double check on that.

  20. Leo says:

    How can I cancel these settings? now when I open the Terminal, is comes with these msg,

    Last login: Fri Jul 8 00:54:22 on console
    declare -x Apple_PubSub_Socket_Render=”/tmp/launch-ZXls9S/Render”
    declare -x COMMAND_MODE=”unix2003″
    declare -x DISPLAY=”/tmp/launch-YhKn82/org.x:0″
    declare -x HOME=”/Users/Leo”
    declare -x LANG=”zh_HK.UTF-8″
    declare -x LOGNAME=”Leo”
    declare -x OLDPWD
    declare -x PATH=”/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin”
    declare -x PWD=”/Users/Leo”
    declare -x SHELL=”/bin/bash”
    declare -x SHLVL=”1″
    declare -x SSH_AUTH_SOCK=”/tmp/launch-aPzgZm/Listeners”
    declare -x TERM=”xterm-256color”
    declare -x TERM_PROGRAM=”Apple_Terminal”
    declare -x TERM_PROGRAM_VERSION=”297″
    declare -x TERM_SESSION_ID=”8E689E7B-A799-48E9-BBEF-C2212C3D513D”
    declare -x TMPDIR=”/var/folders/vp/m98tjrys0513d82bmz4k6dw40000gn/T/”
    declare -x USER=”Leo”
    declare -x __CF_USER_TEXT_ENCODING=”0x1F5:0:0″
    -bash: PATH: command not found

    After I setup these, I can’t use the basic command like “ls” “top” etc
    how can I cancel these settings?
    Thx for helping that…

  21. Leo says:

    How to cancel these settings? I got some Problem after setting with this…
    Now when I open the Terminal, it shows with some msg,
    Last login: Fri Jul 8 00:54:22 on console
    declare -x Apple_PubSub_Socket_Render=”/tmp/launch-ZXls9S/Render”
    declare -x COMMAND_MODE=”unix2003″
    declare -x DISPLAY=”/tmp/launch-YhKn82/org.x:0″
    declare -x HOME=”/Users/Leo”
    declare -x LANG=”zh_HK.UTF-8″
    declare -x LOGNAME=”Leo”
    declare -x OLDPWD
    declare -x PATH=”/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin”
    declare -x PWD=”/Users/Leo”
    declare -x SHELL=”/bin/bash”
    declare -x SHLVL=”1″
    declare -x SSH_AUTH_SOCK=”/tmp/launch-aPzgZm/Listeners”
    declare -x TERM=”xterm-256color”
    declare -x TERM_PROGRAM=”Apple_Terminal”
    declare -x TERM_PROGRAM_VERSION=”297″
    declare -x TERM_SESSION_ID=”8E689E7B-A799-48E9-BBEF-C2212C3D513D”
    declare -x TMPDIR=”/var/folders/vp/m98tjrys0513d82bmz4k6dw40000gn/T/”
    declare -x USER=”Leo”
    declare -x __CF_USER_TEXT_ENCODING=”0x1F5:0:0″
    -bash: PATH: command not found

    Also, after setting this, I can’t use my Terminal with basic command like “ls” “top” etc, Thanks for helping that~

  22. How to set up ADB (Android Debug Bridge) in Mac OSX « Esau Silva http://t.co/kRx7Eoi #android

  23. Jesse Warden says:

    Been struggling to get adb to work on my Mac for 3 weeks now. http://t.co/17cLzy7 Any links that… you know, work?

  24. Jerimiah says:

    Hey, I had the problem with the Galaxy S not connecting with adb. I tried the powered hub trick you suggested and it worked perfectly. Thanks for the tip!

  25. slayton says:

    AWESOME! Got to work – no issues here.

  26. […] Download and install the Android SDK and make sure you can access your phone via ADB upon plugging it in via USB: adb shell. […]

  27. Mojojive says:

    Hi, I have a question.

    I am on a Mac running Lion. 10.7 can someone please write the command I need to write to be able to install multi apk. at one time.

    I have all my backups in a folder on my desktop called. backups and I have like 130 apk files that I backed up from my galaxy S2 and I would like to be able to install that via adb . all at one time. is there a command to do this. if so could someone please write it out for me.
    thank you

  28. peng says:

    How to set up ADB (Android Debug Bridge) in Mac OSX (After step 4, open terminal, type: source ~/.profile) http://t.co/PAfHCvgK

  29. Cory says:

    @TRE_88 according to this.. no.. (im not on a mac just passing info haha) http://t.co/xK8QWk76

  30. utok says:

    Hi sir, where i can found the default path on my mac, because my mac couldn’t back to the default path after i export the sdk path for my anddoid, and now i can acces my terminal, so many command not found because the path is not the default path my osx… thx b4

    • mikel syn says:

      If you haven’t done much with your comp yet, what you can do is open texteditor, then from there, check under recently opened, you should see “.profile”. open it, delete everything inside.

      as of now, i have no idea how to enable both. at the same time, so i’ll have to slowly cd to the directory.

    • mikel syn says:

      Ah. ok. found it. type this directly into your terminal:

      export PATH=${PATH}:/PathToAndroidSdk/android-sdk-mac_86/platform-tools

  31. Stapo says:

    RT @TopsyRT: How to set up ADB (Android Debug Bridge) in Mac OSX http://t.co/nm1A8y8m

  32. RT @TopsyRT: How to set up ADB (Android Debug Bridge) in Mac OSX http://t.co/9v24qLZc

  33. lubing says:

    great, adb works in my macbook air, thank a lot.

  34. Uwe Stoll says:

    How to set up ADB (Android Debug Bridge) in Mac OSX « Esau Silva http://t.co/uIBeIsn1

  35. Maykel says:

    Amazing article. Thank you so much!!
    For those looking for more information about how to use logcat. Take a look at this: http://developer.android.com/guide/developing/debugging/debugging-log.html

  36. raulf says:

    For Mac file transfer, i bumped into android.com/filetransfer

    Quote from the page:
    Android File Transfer is an application for Macintosh computers (running Mac OS X 10.5 or later) you can use to view and transfer files between your Mac and an Android device (running Android 3.0 or later).

    Nice post btw 🙂

  37. ?????? says:

    RT @TopsyRT: How to set up ADB (Android Debug Bridge) in Mac OSX http://t.co/bEDo4OsY

  38. Ambrose Chua says:

    Thanks! I lost windows OS on my hp and this helped me restore root.

  39. Ambrose Chua says:

    Thanks! I lost windows OS on pc and this helped me restore root.

  40. Marius says:

    this is a very useful post.
    THANKS!!

  41. Añadir comandos de android en el terminal de mac http://t.co/HeS5vuJV

  42. Refuse to install Java, but want to debug Android Chrome anyway? ADB zip at http://t.co/bVn5agyf seems legit — Macs don't get viruses right?

  43. @raulsensato con mac cuesta un poco mas pero se puede http://t.co/L0llSxpR

  44. DarrellRR says:

    I am not having any success with these instructions. And I’m not clear on step 4.5. The file created has a blank line above and below some text that means nothing to me, “test -r /sw/bin/init.sh && . /sw/bin/init.sh”
    Do I fill in the “export PATH=${PATH}:/pathToTheAndroidSdkFolder/android-sdk-mac_86/platform-tools” on the line above or below? Or do I replace what’s there entirely? Also, I’ve tried to just cd to it and still have no luck getting it to recognize and display my devices serial number. Please understand that I’ve no experience with these things.

  45. Clint says:

    Thanks for the write-up. I do have one issue that you might be familiar with… I’m trying to use ADB with my Equiso SmartTV dongle and with it attached to my Mac OS X 10.7.5, I issue the “adb devices” command and it keeps returning “List of devices attached ” but there are no devices in the list. The chipset is an ARM Cortex A5. Any thoughts? Thanks in advance for any information you can provide…

  46. @idvck you need to set up ADB as well: http://t.co/IXXAnjcZ

  47. Maldeen says:

    RT @jgezau: How to set up ADB (Android Debug Bridge) in Mac OSX http://t.co/EPUV22Ql

  48. adb shell???????????????????????????orz / How to set up ADB (Android Debug Bridge) in Mac OSX http://t.co/FbERxIg6

  49. Praniti says:

    Thanks a lot…its helped..:D

  50. Thanks! This is very helpful.

  51. bob says:

    doesn’t work
    even with USB hub

  52. Cinzia Casu says:

    Hi; I put adb file directly in /bin and works like a charm. I installed only adb files without sdk..fast&clean….

  53. Lasse says:

    Thanks a bunch!

  54. susuFOX says:

    Thanks for this post!.

  55. tabanbc says:

    This is amazing tutorial. It has shorten my time for developing and app. I like shortcuts.

  56. Qarnac says:

    I just went and bought a j5create USB 3.0 Hub, hoping to resolve the problem of not recognizing my samsung galaxy note 3 from Android Studio. However, the problem persisted. The ADB will recognize the phone for a second or so and then lost it. In addition, Android Studio kept telling me to manually kill all service before restarting ADB.

    I tried to use the hub with and without power. No difference. Any insights?

    Thanks.

  57. Ronald says:

    Thanks a lot. First tried it with the zip file containing just the tools since I’m not planning to develop. But then ‘adb devices’ told me my phone was ‘offline’. Sollution was to download the latest version of the sdk and install the tools that way. Not that much extra work.

  58. jerry says:

    thanks
    i have a macbook, and i have HTC M7 mobile that deleted system no recovery, a month now to search a solution to restore my phone, may you can help me also step by step guid to restore my HTC, I’m only try to repair my own gadget… thanks again

    • jgezau says:

      You can boot into Hboot/Bootloader and use ‘fastboot’ commands to flash a new recovery image. After you have done that, boot into Recovery Mode and use ADB commands to copy a new Stock/Custom Rom and flash it afterwards.

  59. Smithe224 says:

    Howdy! Do you know if they make any plugins to protect against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any recommendations? bkekcddebeccfdce

  60. EMC says:

    I have tried both just using the ADB file and downloading sdk and creating the file path and I am not connecting to my firestick. I am sure that I am just overlooking something, but what?

  61. Dave says:

    I had this working some time ago, and it stopped. After tearing my hair out, nothing working, I double-checked my ‘allow USB debugging setting’ and it had been changed back to ‘not’ somehow, possibly from a system update. Lesson: Just because you set it once doesn’t mean it’s still set.

  62. vdruts says:

    Great tutorial, not working for my Galaxy S7, on Macbook Pro (El Capitan). Downloaded the ADB tools, but it’s saying my phone is Offline… The device get’s listed in the list, but also says offline. Tried a powered USB hub + non-original cable. No luck so far :/

    • jgezau says:

      The ADB tools here are old and they, more than likely, don’t work with modern devices. I would suggest to download the SDK Tools from here SDK Tools Only. Scroll all the way down and you will find the SDK Tools only.

  63. Rob Lewis says:

    It seems that the links to the SDK tools now redirect to the main Android Studio page. I don’t have a clue how to proceed.

  64. duncanSF says:

    Be careful with cheap powered USB hubs: rather a lot of them will backfeed power to the upstream host which can kill your mac (or just that port’s ability to deliver power). Light up cables will expose hubs feeding the wrong port.

Leave a Reply

Your email address will not be published. Required fields are marked *