In this guide, I'm going to show you how to install and use ADB.
Step 1: If you haven't already, download the Android SDK for OSX. The most recent one should be fine. Unzip the file, and move the unzipped folder to wherever you like. Where you put it doesn't much matter, but you have to remember where it is so you can reference the libraries whenever you need to.
/Developer/SDKs/ seems like a cozy spot.
Step 2: Navigate into the unzipped /android-sdk-mac_x86/tools directory and launch the Android SDK Manager application by double-clicking on the executable file entitled "android" or typing
in the terminal. You should get an application window similar to this:
Once the application has launched, select Installed Packages on the left-hand side menu, and check the box beside Android SDK Platform-tools, revision <#>. This is the package that includes ADB, along with some other useful tools.
Click the Install Selected button, and wait while everything is installed.
Step 3: Now ADB is installed, and you are ready to use it to interface with your Android device! Let's test it. Close your terminal window and open a brand new one, just to be safe. Now type
adb devices<br />
You should see the output:
List of devices attached<br />
Of course, ADB sees no devices because none are connected to your computer! Lets fix that. Grab your Android device, and bring up the Settings menu. Go to Settings->Development and make sure the 'USB Debugging' option is checked. Now plug your Android device into a USB port on your computer. Now try
adb devices<br />
again. You should see:
List of devices attached<br /> XXXXXXXXXXXXX device<br />
Congratulations, ADB is installed and working! That number is the unique ID of your device. You can just type
adb shell<br />
to get an ADB shell terminal into your device, and run some commands.
One of my personal favorite features of ADB is the ability to easily push files from your computer onto your device, without even having to open up an ADB shell. From your computer terminal use the command
adb push <source filepath> <destination filepath on device><br /> </destination></source>
It's that easy!
Other useful commands include
adb install <path_to_apk> </path_to_apk>
to install an app, and
adb forward tcp: <port_num> tcp: <port_num> </port_num></port_num>
to set up arbitrary port forwarding.
See the developer documentation for a full list of the ADB commands.