Adding ADB to your path

 

Adding ADB to your path

If you try running adb in a terminal and you see something similar to the message below, read on:

Command Line Interface showing "command not found" after typing adb

ADB (Android Debug Bridge) is command line tool, and if you want to use it from the command line, it needs to be part of your path. First you’ll find where the adb executable lives, then you’ll add that to your path.

1. Find the platform-tools folder which contains adb:

Adb is part of the Android SDK, which is downloaded as part of Android Studio. You can find the location of this SDK by going to Tools -> SDK Manager

ADB is located in this location, followed by platform-tools/ so in the example above, you could find adb in:

/Users/lmf/Library/Android/sdk/platform-tools/

2. Add adb to your path:

Adding a variable to your path varies by platform, follow the instructions below to add the platform-tools location you located above.

Windows

  1. Go to Advanced system settings:
    • Windows 8 and 10: Search -> System (Control Panel) -> Advanced system settings
    • Windows 7: Right-click Computer -> Properties -> Advanced system settings
    • Windows Vista: Right click My Computer -> Properties -> Advanced system settings
    • Windows XP: Start -> Control Panel -> System -> Advanced tab
  2. Click Environment Variables
  3. Find the System Variables section and then look to see if you have a PATH environment variable:
    • If you find one, click Edit
    • If you do not find one, click New to add one
  4. Add ;<Path to platform-tools> to the end of the Variable value box
  5. Click OK on all windows to save
  6. Ensure you can run adb by typing:
    • adb
  7. You should see output, including something like:
text showing Android Debug Bridge version 1.0.40 Version 4986621

Mac/Linux

Adding a path variable is done using the terminal on Mac/Linux.

  1. Open a Terminal
  2. Create a .bash_profile file if you don’t have one already. This is a configuration file for bash) - it’s executed when you start bash:
    • touch ~/.bash_profile
  3. Open up the ~/.bash_profile file in your preferred text editor:
    • open ~/.bash_profile
  4. Add the following to your .bash_profile file and save:
    • export PATH=<Path to platform-tools>:$PATH
  5. Either restart your terminal, or enter:
    • source ~/.bash_profile
  6. Ensure you can run adb by typing:
    • adb
  7. You should see output, including something like:
text showing Android Debug Bridge version 1.0.40 Version 4986621

Comments