adb
command not found
troubleshooting
Android
terminal issues

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.

PlatformTypical 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

bash
which adb

If that returns nothing, search for the binary:

bash
# macOS / Linux
find "$HOME" -type f -name adb 2>/dev/null | head -5
powershell
# Windows PowerShell
Get-ChildItem -Path $env:LOCALAPPDATA -Recurse -Filter adb.exe -ErrorAction SilentlyContinue | Select-Object -First 5

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:

bash
1# macOS with Homebrew
2brew install android-platform-tools
3
4# Ubuntu / Debian
5sudo apt install android-tools-adb
6
7# Fedora
8sudo dnf install android-tools

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)

bash
# Add to ~/.zshrc
export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"
export PATH="$ANDROID_SDK_ROOT/platform-tools:$PATH"

Reload and verify:

bash
source ~/.zshrc
adb version

macOS and Linux (bash)

bash
# Add to ~/.bashrc or ~/.bash_profile
export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"
export PATH="$ANDROID_SDK_ROOT/platform-tools:$PATH"
bash
source ~/.bashrc
adb version

Windows

  1. Open System Properties > Advanced > Environment Variables.
  2. Under "User variables", select Path and click Edit.
  3. Add C:\Users\<your-user>\AppData\Local\Android\Sdk\platform-tools
  4. Click OK, open a new Command Prompt or PowerShell window (existing windows keep the old PATH) and run:
powershell
adb version

Step 4: verify

Check both command resolution and device connectivity:

bash
adb version
adb devices

Expected output:

plaintext
1Android Debug Bridge version 1.0.41
2Version 35.0.1-11580240
3
4List of devices attached
5emulator-5554   device

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:

plaintext
adb server version (41) doesn't match this client (40); killing...

Check which binary your shell resolves:

bash
which adb
adb version

Then check the one in the SDK folder:

bash
~/Library/Android/sdk/platform-tools/adb --version 2>/dev/null || echo "Not found at SDK path"

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:

bash
~/Library/Android/sdk/platform-tools/adb devices

Or create an alias:

bash
alias adb="$HOME/Library/Android/sdk/platform-tools/adb"

This works interactively but not for scripts or CI pipelines that expect adb on PATH.

Mistakes that keep the error coming back

  • Editing ~/.bashrc when your shell is zsh. Modern macOS defaults to zsh, which reads ~/.zshrc. Run echo $SHELL to check.
  • Adding the SDK root instead of platform-tools. adb is inside platform-tools/, so adding ~/Library/Android/sdk does nothing.
  • Testing in an old terminal window. Open a new terminal or run source ~/.zshrc after editing the config.
  • Two conflicting adb versions from Android Studio and a package manager, causing client-server mismatch errors.
  • Missing udev rules on Linux. Even with adb on the path, USB devices may not appear without proper permissions. Install android-udev-rules or add a custom rule file.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No 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 course
Data 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.

Practice algorithms