How to fix “adb: command not found” in Linux/macOS

Are you looking for a solution to “adb: command not found” error in Linux?

adb, stands for Android Debug Bridge, is one of the most important command line interface tool of the Android SDK software suite. adb can be used to perform a huge number of operations on your Android phone, raning from backing up the entire memory to removing certain default applications/bloatware (which are normally locked down by the OS).

In the article below, we will show you a few ways to troubleshoot if you’re encountering “adb: command not found” on your Linux or macOS based system. The instructions are applicable to most Linux distributions, including Debian, Ubuntu, Fedora, CentOS, Linux Mint, etc.

Also check out: How to install Pyenv in Ubuntu

Why does “adb: command not found” happens?

“adb: command not found” simply indicates that the system cannot find adb executable in its default location, usually /usr/bin or /usr/local/bin. This is similar to most of the other “command not found” errors, including “pip: command not found”, conda: command not found or “apt-get command not found”.

There are many things that can cause the absence of adb executable file, but below are some of the most common ones.

  • android-tools-adb is not installed on the system.
  • adb executable was accidentally deleted or corrupted.
  • adb executable directory is not included in $PATH environment variable

Fix 1: Reinstall adb from android-tools-adb

If you’re using Debian/Ubuntu or one of the Linux distributions based on Debian or Ubuntu, you can simply have adb installed on your system by installing the android-tools-adb package. In order to do that, run the following command on any terminal window.

sudo apt-get install android-tools-adbCode language: JavaScript (javascript)

Fedora,CentOS or SUSE-based Linux users can type the following command to install ADB:

sudo yum install android-tools

Fix 2: Reinstall adb manually from Android SDK

Actually, you don’t really need to install any package to get ADB working. Instead, you can get adb executable from the official Android SDK and place it in the right directory.

  • Scroll through the Android SDK Platform-Tools Terms and Conditions, select I have read and agree with the above terms and conditions and click the Download button.
  • Extract the file.
  • Suppose the extracted contents are located in your home directory, run the following command to create a symbolic link to /usr/bin so that the OS recognizes adb command. Then, restart the machine in order for the changes to take effect.
sudo ln -s ~/platform-tools/adb /usr/bin/adb
sudo chmod +x /usr/bin/adbCode language: JavaScript (javascript)

Fix 3: Start adb from terminal before running other programs

If you’re developing using one of JetBrains applications (namely PHPStorm, PyCharm, etc), you may notice that doesn’t matter how you configure the shell (Bash/ZSH/etc., you cannot start adb from its integrated command line emulator. Contrary to that, running adb from terminal works flawlessly.

In this case, the problem comes from the fact that JetBrains applications doesn’t inherits the shell default configuration. If the IDE is launched from Terminal, it inherits Terminal environment, so it sees your variables defined in bash config. But this is not the case when the IDE is started from desktop. Your best solution is to start adb from a terminal before running any other program.

If you’re using bash as the default shell, you can try a workaround: edit your PhpStorm launcher and set command to /bin/bash -i -c /path/to/, to make sure that .bashrc is read before running PhpStorm.

We hope that this tutorial provides useful information to help you solve the “adb: command not found” error effectively and quickly. If you spot any error in the article, or have a suggestion, please let us know via the comment section below.

You might also want to check out our guide on fixing other common “command not found” error messages with nodemon, java, npm or composer.

Leave a Comment