Fix adb: command not found on macOS, Linux and Windows
Codemia Knowledge Hub ·
adb: command not found means your shell cannot locate the Android Debug Bridge binary. Either the Android SDK platform-tools package is not installed, or it is installed but the directory containing adb is not on your shell's PATH.
Where adb lives
adb ships with the Android SDK platform-tools package. It is not a built-in operating system command, so your terminal only finds it if the binary exists on disk and its directory is listed in PATH.
| Platform | Typical Path |
| macOS (Android Studio) | ~/Library/Android/sdk/platform-tools/ |
| Linux (Android Studio) | ~/Android/Sdk/platform-tools/ |
| Linux (apt install) | /usr/lib/android-sdk/platform-tools/ |
| Windows (Android Studio) | C:\Users\<user>\AppData\Local\Android\Sdk\platform-tools\ |
| Homebrew (macOS) | /opt/homebrew/bin/ (symlinked) |
Step 1: check whether adb is installed
If that returns nothing, search for the binary:
No results means platform-tools is not installed.
Step 2: install platform-tools
Android Studio: go to Settings > Languages & Frameworks > Android SDK > SDK Tools, check "Android SDK Platform-Tools" and click Apply.
Standalone download: download the platform-tools ZIP from the official Android developer site, extract it and note the directory path.
Package manager:
Homebrew and apt typically put adb in a directory already on your PATH, so you may be done.
Step 3: add platform-tools to PATH
After an Android Studio or ZIP install, add the directory to your shell configuration.
macOS and Linux (zsh)
Reload and verify:
macOS and Linux (bash)
Windows
- Open System Properties > Advanced > Environment Variables.
- Under "User variables", select
Pathand click Edit. - Add
C:\Users\<your-user>\AppData\Local\Android\Sdk\platform-tools - Click OK, open a new Command Prompt or PowerShell window (existing windows keep the old
PATH) and run:
Step 4: verify
Check both command resolution and device connectivity:
Expected output:
If adb version works but adb devices lists nothing, the path problem is solved and you have a separate connection issue (USB debugging not enabled, emulator not running, etc.).
Why Android Studio finds adb when your terminal does not
Android Studio reads the SDK path from its own settings (local.properties or the SDK Manager configuration). Your shell relies only on PATH. So "it works in Android Studio" says nothing about your terminal, and scripts, CI pipelines and other command-line tools need PATH set up separately.
Two adb installations with different versions
Installing platform-tools through both Android Studio and a package manager can leave two adb versions, which causes errors like:
Check which binary your shell resolves:
Then check the one in the SDK folder:
If they differ, uninstall the duplicate or make PATH consistently point to the one you want.
Running adb without changing PATH
Call it by full path:
Or create an alias:
This works interactively but not for scripts or CI pipelines that expect adb on PATH.
Mistakes that keep the error coming back
- Editing
~/.bashrcwhen your shell is zsh. Modern macOS defaults to zsh, which reads~/.zshrc. Runecho $SHELLto check. - Adding the SDK root instead of
platform-tools.adbis insideplatform-tools/, so adding~/Library/Android/sdkdoes nothing. - Testing in an old terminal window. Open a new terminal or run
source ~/.zshrcafter editing the config. - Two conflicting
adbversions from Android Studio and a package manager, causing client-server mismatch errors. - Missing
udevrules on Linux. Even withadbon the path, USB devices may not appear without proper permissions. Installandroid-udev-rulesor add a custom rule file.
Related reading
- adb devices no permissions user in plugdev group; are your udev rules wrong?
- ADB Install Fails With INSTALL_FAILED_TEST_ONLY
- ADB No Devices Found
- adb not finding my device / phone MacOS X
- ''adb'' is not recognized as an internal or external command, operable program or batch file
- Add a body to a 404 Not Found Exception
- ADB Shell Input Events
- Add a border outside of a UIView instead of inside
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo course covers this one yet
Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.
Build my courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.