adb
command not found
troubleshooting
Android
terminal issues

adb command not found

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

adb: command not found means your shell cannot locate the Android Debug Bridge binary. The fix is almost always one of two things: either the Android SDK platform-tools package is not installed, or it is installed but the directory containing the adb executable is not on your shell's PATH. This guide covers both situations across macOS, Linux, and Windows, plus the edge cases that trip people up after the initial fix.

What adb Is and Where It Lives

adb (Android Debug Bridge) is a command-line tool shipped as part of the Android SDK platform-tools package. It is not a built-in operating system command. Your terminal can only find it if:

  1. The binary exists on disk.
  2. The directory containing it is listed in your shell's PATH environment variable.

Default installation locations by platform:

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 if adb Is Installed

First, determine whether the binary exists anywhere on your system:

bash
which adb

If that returns nothing, search for it:

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

If no results come back, platform-tools is not installed. Move to the installation step.

Step 2: Install Platform-Tools

You have three options depending on your setup:

Option A: Through Android Studio. Open Android Studio, go to Settings > Languages & Frameworks > Android SDK > SDK Tools, check "Android SDK Platform-Tools", and click Apply.

Option B: Standalone download. Download the platform-tools ZIP from the official Android developer site, extract it, and note the directory path.

Option C: 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

The Homebrew and apt installations typically add adb to a directory already on your PATH, so you may be done after installing.

Step 3: Add platform-tools to PATH

If you installed through Android Studio or the standalone ZIP, you need to 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", find Path and click Edit.
  3. Add a new entry: C:\Users\<your-user>\AppData\Local\Android\Sdk\platform-tools
  4. Click OK, open a new Command Prompt or PowerShell window, and run:
powershell
adb version

You must open a new terminal window. Existing windows retain the old PATH.

Step 4: Verify the Fix

After updating PATH, confirm 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 shows an empty list, the path problem is solved and you have a separate device connection issue (USB debugging not enabled, emulator not running, etc.).

Android Studio vs. Terminal Environment

A common point of confusion: Android Studio can find adb even when your terminal cannot. Android Studio reads the SDK path from its own internal settings (local.properties or the SDK Manager configuration), but your shell relies exclusively on PATH.

So "it works in Android Studio" does not mean your terminal is configured correctly. If you run scripts, CI pipelines, or other tools that call adb from the command line, the terminal PATH must be set up independently.

Multiple adb Installations

If you have installed platform-tools through both Android Studio and a package manager (Homebrew, apt), you may end up with two different versions of adb. This can cause confusing version mismatch errors:

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 if Android Studio uses a different one:

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

If the versions differ, either uninstall the duplicate or make sure your PATH consistently points to the version you want to use.

Using adb Without Modifying PATH

If you do not want to modify your shell configuration, you can invoke adb by its full path:

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

Or create a shell alias:

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

This works for interactive use but will not help scripts or CI pipelines that expect adb on the PATH.

Common Pitfalls

  • Editing ~/.bashrc when your shell is zsh. On modern macOS, the default shell is zsh, which reads ~/.zshrc, not ~/.bashrc. Run echo $SHELL to confirm which shell you are using.
  • Adding the SDK root to PATH instead of the platform-tools subdirectory. The adb binary lives inside platform-tools/, not at the SDK root. Adding ~/Library/Android/sdk to your path will not help.
  • Forgetting that existing terminal windows keep the old environment. After modifying a shell config file, you must open a new terminal or run source ~/.zshrc to pick up changes.
  • Having two conflicting adb versions from Android Studio and a package manager, leading to client-server version mismatch errors.
  • On Linux, missing the udev rules for USB devices. Even with adb on the path, USB-connected devices may not appear without proper permissions. Install android-udev-rules or add a custom rule file.

Summary

  • adb: command not found means the platform-tools directory is missing from your PATH or platform-tools is not installed at all.
  • Install platform-tools through Android Studio, a standalone download, or your system's package manager.
  • Add the platform-tools directory (not the SDK root) to your shell's PATH and reload the configuration.
  • Open a new terminal after making PATH changes; existing sessions retain the old environment.
  • Verify with adb version and adb devices to confirm both path resolution and device connectivity.
  • Watch for version conflicts if platform-tools is installed in multiple locations.

Related reading
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
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.