[GUIDE] Using ADB & FASTBOOT in OSX / Mac

Search This thread

siedkins

Senior Member
Jul 3, 2008
295
78
London
Hi,
I thought I'd add this here because I've recently starting using OSX after building my own hackintosh out of PC parts. I got very fed up with Windows and the need for drivers all over the shop so I'm moved over now.

I've also just got into flashing my HTC Desire and it was made very easy by lots of the guys here. One thing that will always be useful when rooting and flashing your phone is ADB. There are lots of guides out there for ADB on Windows but I wanted to run in natively in OSX.

After a lot of research and a few failed attempts .... I've now worked out how to run ADB in OSX.

What you will need:
A Mac
USB cable
Android SDK for OSX- http://developer.android.com/sdk/index.html

At the time of writing this the version was "android-sdk_r08-mac_86" so please have a look at the above link and let me know if you can't find that same version.

So download the zip file and I would extract it to a folder where you are happy to keep it such as within your user home folder i.e. Macintosh HD/Users/{Your User Name} and for my mac it is Users/siedkins which is how I have my OSX set up.

Then open then still in Finder, open "android-sdk-mac_86" then "tools".

Now launch Terminal - ⌘ + space then type Terminal or Applications>Utilities>Terminal

Now drag and drop the file called "android" in the "tools" folder into your terminal window and you should see something like:
/Users/siedkins/android-sdk-mac_86/tools/android

Then hit enter - this should load Android SDK

Next go to Available Packages on the left and Android Repository > Android SDK Platform-tools, revision 1 -tick the box and hit "Install Selected"

It should download and install the Platform Tools which includes ADB !!!!

Now quit Android SDK after it has downloaded and go back into Finder. Now you should see a new folder "platform-tools" in the "android-sdk-mac_86" folder. Open that and you can now see a file called adb.

Now .... I am going to show you how to make your life a lot easier in Terminal to run ADB without having to navigate to the folder every time you want to launch it.

Go back to your Terminal window and type (or copy & paste):
Code:
cd ~
The screen should then look like
NAME_OF_YOUR_MACHINE:~ USERNAME$

For me I have:
Mac-Pro:~ siedkins$

Next, type
Code:
touch .bash_profile
to create your new bash / path file

Next, type
Code:
open -e .bash_profile
to open it in TextEdit.

Now into Text Edit please copy:
Code:
export PATH=${PATH}:
Then go into Finder and navigate your your "android-sdk-mac_86" folder. Then click on the "platform-tools" folder and drag and drop this into TextEdit at the end of the code above that you copied. Mine looks like:
export PATH=${PATH}:/Users/siedkins/android-sdk-mac_86/platform-tools/

Yours should look like:
export PATH=${PATH}:insert your path to the "platform-tools" folder in your Android SDK here

All you need is that one line. Then Save and exit TextEdit and then very importantly QUIT TERMINAL.

***** If you have issues being able to save the file at all then please jump to the bottom of the post*****

Now ........ to turn on USB Debugging in your handset Settings > Applications > Development > USB Debugging - ticked and also go to Settings > Connect to PC > Default connection type > Charge Only and also UNTICK "Ask me ..." there also. You can always go back here and change these settings back.

Now plug in your phone to a USB port. I noticed that if I plugged my phone into one of the standard USB ports on the front of my machine I couldn't see the phone further down the line and if I plugged it into a powered USB port on the front (I have an "akasa AK-ICR-08" which has a powered connector behind the 5 USB ports. But you guys will probably be using a MacBook or MacPro and there shouldn't be any issues with the power to your USB ports.

Now to launch ADB - re-open terminal (remember that you had quit it - very important!) then type in:
Code:
adb devices
And you should see:
List of devices attached
HXXXXXXXXXX device


where XXXXXXXX is your unique phone ID.

Now you can run all of your favourite ADB commands straight by typing:
adb shell

etc straight into Terminal. I won't go into that here as there are plenty of guides about what to do with ADB once it's installed!

:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D

Now you have ADB setup on your Mac and can run it without the need for installing HTC Sync - un-installing it - loading some modified drivers over the top !!!!

It all just works !!!!!!

Please drop me a line if you have any queries about this !


******************


If you are have user account issues such as Terminal or TextEdit says that you can't do anything then try adding "sudo" to the front of your terminal command as this will allow you to execute the account as a superuser or root user for OSX! ROOT!!! Note that you will have to enter your password to enable the superuser access rights and you won't see anything as you type in your password.

i.e. try:
Code:
sudo touch .bash_profile
then
Code:
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit .bash_profile
(slight change in the coding here to ensure that TextEdit opens

Or you could do:
Code:
sudo pico .bash_profile
This will open up the Pico text editor instead of TextEdit. Here you will have to type out all of the text then you press "ctrl+x" to exit and then you can save on the next screen. To check that has worked you can then open the file in terminal again and check it with the normal command:
Code:
open -e .bash_profile
******************

Please see post #37 for How To Use ADB Over WIRELESS !!!!

************************************************************************
EDIT - 27th JAN 2010

FastBoot

I've now found you all a precompiled version of Fast Boot:
http://developer.htc.com/adp.html

Please download and unzip the precompiled version for OSX to your "SDK/platform-tools" folder.

Rename the unzipped file from "fastboot-mac" just to "fastboot". You need to fix the permissions of the fastboot file using CHMOD in Terminal.

In Terminal navigate to your "SDK/platform-tools" folder and then type:
Code:
ls
You should see all of the files in your "platform-tools" folder such as adb, aapt, fastboot, etc.

Then type:
Code:
chmod 777 fastboot
PLEASE NOTE THAT I AM ASSUMING THAT YOU HAVE CHANGED THE FILE NAME ABOVE !

Now with the permissions fixed you should be able to run fastboot.

Connect your phone via USB and set to "charging only". Then turn off your phone and leave the USB in. Then hold the back key and then turn your phone on again. You will have a white screen with 3 skateboarding androids on.

Now in Terminal type:
Code:
fastboot devices

And you should see your unqiue phone ID! (Note that you have to be at that white screen with the skateboarders for the "fastboot devices" code to run!

Now you have a fully working fastboot !!!

Sorry this explanation is a bit short - I did write out a longer one but my browser crashed and I lost it all. However if you cannot follow the above then I think it's maybe best that you don't use fastboot as you could seriously brick your phone.

NOTE - I HAVE NEVER USED FASTBOOT TO FLASH A RADIO OR PHONE SO I PROBABLY WON'T BE ABLE TO HELP IF YOU GET ERRORS IN USING FASTBOOT OR FLASHING YOUR DEVICE ! The above information is how to shortcut the navigation to the folder. Please don't blame me if you break the recovery image of your phone!
 
Last edited:

dhoshman

Senior Member
Jul 8, 2010
260
36
Indianapolis
www.youtube.com
Thanks for such a thorough step by step guide. But Im having a problem I followed the directions and at the last step I get "permission denied". Any tips for me would be truly appreciated. Thanks
 

madj42

Senior Member
Jun 23, 2010
224
31
Minnesota
Thanks for such a thorough step by step guide. But Im having a problem I followed the directions and at the last step I get "permission denied". Any tips for me would be truly appreciated. Thanks

What version of MacOS? Also are you sure your device is properly rooted? I'm assuming you are getting the error when typing "adb devices"?

EDIT: That's what I get for being distracted while typing this.. ;-)
 
Last edited:
T

_thalamus

Guest
The easiest way to get the sdk is by using homebrew, which is an amazingly useful tool. https://github.com/mxcl/homebrew

Code:
brew install android-sdk

It doesn't add adb to your path however, you have to do that manually by adding /usr/local/Cellar/android-sdk/r8/platform-tools to your path.

Hope that makes it a little bit easier. :)
 

mun-key

Member
Dec 18, 2010
30
0
I found that on my mac using terminal I have to always start the adb commands with a ./ otherwise it wouldn't work right. This might be common knowledge for some, but I'm a terminal newbie

So, for example:

./adb devices
 

manleyaudio

Senior Member
Oct 29, 2010
239
95
Seattle
Thanks for the walk through

This work great. I put the the SDK folder on the root of Macintosh HD and renamed it to AndroidSDK. Then in the .bash_profile my path was /AndroidSDK/platform-tools/ . I then made a backup of my SD card with adb pull from /mnt/sdcard to my local machine.
 

madj42

Senior Member
Jun 23, 2010
224
31
Minnesota
I found that on my mac using terminal I have to always start the adb commands with a ./ otherwise it wouldn't work right. This might be common knowledge for some, but I'm a terminal newbie

So, for example:

./adb devices

Kind of weird. To me that would mean that you're path variable isn't setup correctly. Usually the ./ before a command means to run the command from the current directory and ignore the path variable.
 

Krisrk

Member
Apr 16, 2007
34
1
Miami, FL
It doesn't even have to be this complicated. Download the sdk, whatever files you want to push to your phone put it in the same folder. Then do the commands (./adb push). Simple.
 

mun-key

Member
Dec 18, 2010
30
0
Kind of weird. To me that would mean that you're path variable isn't setup correctly. Usually the ./ before a command means to run the command from the current directory and ignore the path variable.

Ok - that makes sense now. And reading Krisrk's reply, that's exactly how I did it.

On my device I only needed to push a single file. Don't really need adb anymore. Your post was like 12-hours too late for me though. I spent 3 hours trying to figure out why it wouldn't work, then saw the ./ in a youtube video. After that I was rooted with a new rom in minutes :rolleyes:

thanks for all the great info guys
 

SterAllures

Senior Member
Sep 4, 2008
108
18
Just wanted to thank you! I already had ADB working on my Mac OSX but didn't have the "environment variables" in the .bash_profile. So now I can just use adb commands directly without going into the finder and find the adb!

Also, kudos for the very detailed guide with your own examples, that reads very well!
 

siedkins

Senior Member
Jul 3, 2008
295
78
London
Thanks for the comments guys.

I know that you can navigate to the SDK folder and just run it from there but I thought that people might like the above guide to do the shortcut once and then never have to jump around folders again in terminal which is a bit of a pain. Plus my method removes the need for the "./" prefix.

anyways I'm easy I'm sure that everyone will have their own preferred method if you already use adb on OSX
 
  • Like
Reactions: gravis86

siedkins

Senior Member
Jul 3, 2008
295
78
London
What type of user account do you have set up in OSX?

System Prefs > Accounts

Also what about trying the following in Terminal

Code:
sudo touch .bash_profile

And then enter the password for your user profile?

Any better?
 

robot_agenda

Member
Oct 13, 2010
38
1
Northern Virginia
What type of user account do you have set up in OSX?

System Prefs > Accounts

Also what about trying the following in Terminal

Code:
sudo touch .bash_profile

And then enter the password for your user profile?

Any better?

it popped up and asked my password, then it said i entered the wrong one and i never was asked this again. this is incredibly frustrating as i cannot even get it to work in windows :mad:


edit: ok got to the part where i bring up text edit, but it will not let me save. states i do not have permission to save. is there a way i can turn off this password crap for the time being? all i want to do is push files to my phone, i can't even get this far :(
 
Last edited:

TheSilverStig

Senior Member
Jul 21, 2010
185
8
Detroit
Ok...

I'm trying not to look stupid, but for gods sake, im stuck at the first command. I copy paste cd~ and nothing happens. press enter nothing. I've been reading up on terminal and i still feel quite stupid considering how im stuck on step one :confused:



edit: got it! I got lost going back into the same terminal and not closing the android sdk window. there fore I was still in the sdk and not telling the computer anything. a dur. Opening a new terminal and doing all of the steps did the trick. Thanks for this btw!
 
Last edited:

monstereo

Senior Member
Jul 29, 2010
129
5
Melbourne
thanks for the detailed guide. i've been looking all over the web for a guide to setup adb for MAC. followed the steps here and now, i'm able to use ADB on my macbook. YAY!! :D
 

Top Liked Posts

  • There are no posts matching your filters.
  • 46
    Hi,
    I thought I'd add this here because I've recently starting using OSX after building my own hackintosh out of PC parts. I got very fed up with Windows and the need for drivers all over the shop so I'm moved over now.

    I've also just got into flashing my HTC Desire and it was made very easy by lots of the guys here. One thing that will always be useful when rooting and flashing your phone is ADB. There are lots of guides out there for ADB on Windows but I wanted to run in natively in OSX.

    After a lot of research and a few failed attempts .... I've now worked out how to run ADB in OSX.

    What you will need:
    A Mac
    USB cable
    Android SDK for OSX- http://developer.android.com/sdk/index.html

    At the time of writing this the version was "android-sdk_r08-mac_86" so please have a look at the above link and let me know if you can't find that same version.

    So download the zip file and I would extract it to a folder where you are happy to keep it such as within your user home folder i.e. Macintosh HD/Users/{Your User Name} and for my mac it is Users/siedkins which is how I have my OSX set up.

    Then open then still in Finder, open "android-sdk-mac_86" then "tools".

    Now launch Terminal - ⌘ + space then type Terminal or Applications>Utilities>Terminal

    Now drag and drop the file called "android" in the "tools" folder into your terminal window and you should see something like:
    /Users/siedkins/android-sdk-mac_86/tools/android

    Then hit enter - this should load Android SDK

    Next go to Available Packages on the left and Android Repository > Android SDK Platform-tools, revision 1 -tick the box and hit "Install Selected"

    It should download and install the Platform Tools which includes ADB !!!!

    Now quit Android SDK after it has downloaded and go back into Finder. Now you should see a new folder "platform-tools" in the "android-sdk-mac_86" folder. Open that and you can now see a file called adb.

    Now .... I am going to show you how to make your life a lot easier in Terminal to run ADB without having to navigate to the folder every time you want to launch it.

    Go back to your Terminal window and type (or copy & paste):
    Code:
    cd ~
    The screen should then look like
    NAME_OF_YOUR_MACHINE:~ USERNAME$

    For me I have:
    Mac-Pro:~ siedkins$

    Next, type
    Code:
    touch .bash_profile
    to create your new bash / path file

    Next, type
    Code:
    open -e .bash_profile
    to open it in TextEdit.

    Now into Text Edit please copy:
    Code:
    export PATH=${PATH}:
    Then go into Finder and navigate your your "android-sdk-mac_86" folder. Then click on the "platform-tools" folder and drag and drop this into TextEdit at the end of the code above that you copied. Mine looks like:
    export PATH=${PATH}:/Users/siedkins/android-sdk-mac_86/platform-tools/

    Yours should look like:
    export PATH=${PATH}:insert your path to the "platform-tools" folder in your Android SDK here

    All you need is that one line. Then Save and exit TextEdit and then very importantly QUIT TERMINAL.

    ***** If you have issues being able to save the file at all then please jump to the bottom of the post*****

    Now ........ to turn on USB Debugging in your handset Settings > Applications > Development > USB Debugging - ticked and also go to Settings > Connect to PC > Default connection type > Charge Only and also UNTICK "Ask me ..." there also. You can always go back here and change these settings back.

    Now plug in your phone to a USB port. I noticed that if I plugged my phone into one of the standard USB ports on the front of my machine I couldn't see the phone further down the line and if I plugged it into a powered USB port on the front (I have an "akasa AK-ICR-08" which has a powered connector behind the 5 USB ports. But you guys will probably be using a MacBook or MacPro and there shouldn't be any issues with the power to your USB ports.

    Now to launch ADB - re-open terminal (remember that you had quit it - very important!) then type in:
    Code:
    adb devices
    And you should see:
    List of devices attached
    HXXXXXXXXXX device


    where XXXXXXXX is your unique phone ID.

    Now you can run all of your favourite ADB commands straight by typing:
    adb shell

    etc straight into Terminal. I won't go into that here as there are plenty of guides about what to do with ADB once it's installed!

    :D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D

    Now you have ADB setup on your Mac and can run it without the need for installing HTC Sync - un-installing it - loading some modified drivers over the top !!!!

    It all just works !!!!!!

    Please drop me a line if you have any queries about this !


    ******************


    If you are have user account issues such as Terminal or TextEdit says that you can't do anything then try adding "sudo" to the front of your terminal command as this will allow you to execute the account as a superuser or root user for OSX! ROOT!!! Note that you will have to enter your password to enable the superuser access rights and you won't see anything as you type in your password.

    i.e. try:
    Code:
    sudo touch .bash_profile
    then
    Code:
    sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit .bash_profile
    (slight change in the coding here to ensure that TextEdit opens

    Or you could do:
    Code:
    sudo pico .bash_profile
    This will open up the Pico text editor instead of TextEdit. Here you will have to type out all of the text then you press "ctrl+x" to exit and then you can save on the next screen. To check that has worked you can then open the file in terminal again and check it with the normal command:
    Code:
    open -e .bash_profile
    ******************

    Please see post #37 for How To Use ADB Over WIRELESS !!!!

    ************************************************************************
    EDIT - 27th JAN 2010

    FastBoot

    I've now found you all a precompiled version of Fast Boot:
    http://developer.htc.com/adp.html

    Please download and unzip the precompiled version for OSX to your "SDK/platform-tools" folder.

    Rename the unzipped file from "fastboot-mac" just to "fastboot". You need to fix the permissions of the fastboot file using CHMOD in Terminal.

    In Terminal navigate to your "SDK/platform-tools" folder and then type:
    Code:
    ls
    You should see all of the files in your "platform-tools" folder such as adb, aapt, fastboot, etc.

    Then type:
    Code:
    chmod 777 fastboot
    PLEASE NOTE THAT I AM ASSUMING THAT YOU HAVE CHANGED THE FILE NAME ABOVE !

    Now with the permissions fixed you should be able to run fastboot.

    Connect your phone via USB and set to "charging only". Then turn off your phone and leave the USB in. Then hold the back key and then turn your phone on again. You will have a white screen with 3 skateboarding androids on.

    Now in Terminal type:
    Code:
    fastboot devices

    And you should see your unqiue phone ID! (Note that you have to be at that white screen with the skateboarders for the "fastboot devices" code to run!

    Now you have a fully working fastboot !!!

    Sorry this explanation is a bit short - I did write out a longer one but my browser crashed and I lost it all. However if you cannot follow the above then I think it's maybe best that you don't use fastboot as you could seriously brick your phone.

    NOTE - I HAVE NEVER USED FASTBOOT TO FLASH A RADIO OR PHONE SO I PROBABLY WON'T BE ABLE TO HELP IF YOU GET ERRORS IN USING FASTBOOT OR FLASHING YOUR DEVICE ! The above information is how to shortcut the navigation to the folder. Please don't blame me if you break the recovery image of your phone!
    5
    I thought some people might appreciate the instructions to get adb working over WiFi too and this seems like a good place to put it:

    Type this in your terminal emulator on your Android device:
    Code:
    setprop service.adb.tcp.port 5555
    stop adbd
    start adbd

    Then check it with this:
    Code:
    getprop service.adb.tcp.port

    If it doesn't return "5555" and you're rooted, then do a "su" command and try again. You shouldn't need to be rooted for adb over wifi to work, but I haven't tried every device:
    Code:
    su
    setprop service.adb.tcp.port 5555
    stop adbd
    start adbd

    Then check it:
    Code:
    getprop service.adb.tcp.port

    When it returns "5555" then run this command in the terminal (or command prompt) on your computer:
    Code:
    adb connect 192.168.0.151
    (Obviously enter your device's IP address. You must be on the same network as the computer that has the Android SDK installed.)

    And you should be connected!

    To tell the Android device to listen for adb on the USB port instead of TCP again, enter this into the terminal emulator:
    Code:
    setprop service.adb.tcp.port -1
    stop adbd
    start adbd
    (again, might need "su" on your device)

    Or just reboot the Android device.

    And to tell your computer to use USB for adb instead of TCP:
    Code:
    adb usb

    Now, keep in mind, when your Android device is listening for adb via WiFi, it's wide open... anybody that that the Android SDK installed and knows your device's IP address can access it without a password.

    HTH,
    Billy

    PS - Your
    thanks.jpg
    are appreciated! ;)
    4
    The fastboot for mac is no longer there in the link. I reupload here for those who need it, dun forget to thanks me ;)
    2
    I had adb working fine last week, but now when I try to issue any commands, I get:

    mac:~ bob$ adb shell
    error: device not found

    and

    mac:~ bob$ adb devices
    List of devices attached

    My rooted Nook Color is attached and gets mounted to my Desktop, so I know the Mac sees it. I suspect I am missing something very basic, but what??

    If it mounts to your desktop then you have it in DISK DRIVE mode rather than CHARGE ONLY

    I don't have a Nook but you need to stop it from mounting as a disk drive, allow it just to charge and turn on USB Debugging mode.
    1
    Thanks for the comments guys.

    I know that you can navigate to the SDK folder and just run it from there but I thought that people might like the above guide to do the shortcut once and then never have to jump around folders again in terminal which is a bit of a pain. Plus my method removes the need for the "./" prefix.

    anyways I'm easy I'm sure that everyone will have their own preferred method if you already use adb on OSX