adb
command prompt error
troubleshooting
Windows
development tools

'adb' is not recognized as an internal or external command, operable program or batch file

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

The error 'adb' is not recognized as an internal or external command, operable program or batch file means your system cannot find the ADB executable. The fix is to add the Android SDK platform-tools directory to your system's PATH environment variable. This takes about two minutes on Windows, macOS, or Linux.

What Is ADB and Where Does It Live?

ADB (Android Debug Bridge) is a command-line tool that ships with the Android SDK. It lets you communicate with an Android device or emulator for tasks like installing apps, capturing logs, running shell commands, and transferring files.

The adb executable is located inside the platform-tools directory of your Android SDK installation. Common default paths:

OSDefault SDK LocationADB Path
WindowsC:\Users\<user>\AppData\Local\Android\Sdk...\Sdk\platform-tools\adb.exe
macOS~/Library/Android/sdk~/Library/Android/sdk/platform-tools/adb
Linux~/Android/Sdk~/Android/Sdk/platform-tools/adb

If you installed Android Studio, the SDK was downloaded automatically to one of these locations. If you installed SDK Platform-Tools standalone, it could be anywhere you extracted it.

Fix for Windows: Add ADB to PATH

Method 1: Through System Settings (Permanent)

  1. Press Win + S and search for "Environment Variables"
  2. Click "Edit the system environment variables"
  3. Click the "Environment Variables" button at the bottom
  4. Under "User variables" (or "System variables" for all users), select Path and click Edit
  5. Click New and paste the path to your platform-tools directory:
 
C:\Users\YourUsername\AppData\Local\Android\Sdk\platform-tools
  1. Click OK on all dialogs
  2. Close all open Command Prompt or PowerShell windows
  3. Open a new Command Prompt and test:
cmd
adb version

Method 2: Via Command Line (Permanent for Current User)

cmd
setx PATH "%PATH%;C:\Users\YourUsername\AppData\Local\Android\Sdk\platform-tools"

Close and reopen your terminal after running this command.

Method 3: Temporary Session Fix

If you just need ADB for the current terminal session:

cmd
set PATH=%PATH%;C:\Users\YourUsername\AppData\Local\Android\Sdk\platform-tools
adb version

This resets when you close the terminal.

Fix for macOS: Add ADB to PATH

For zsh (default on macOS Catalina and later)

bash
1# Open your shell profile
2nano ~/.zshrc
3
4# Add this line at the end
5export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools
6
7# Save (Ctrl+O, Enter, Ctrl+X) and reload
8source ~/.zshrc
9
10# Verify
11adb version

For bash (older macOS versions)

bash
1# Open your bash profile
2nano ~/.bash_profile
3
4# Add this line at the end
5export PATH=$PATH:$HOME/Library/Android/sdk/platform-tools
6
7# Save and reload
8source ~/.bash_profile
9
10# Verify
11adb version

Fix for Linux: Add ADB to PATH

Option 1: Modify Shell Profile

bash
1# For bash
2echo 'export PATH=$PATH:$HOME/Android/Sdk/platform-tools' >> ~/.bashrc
3source ~/.bashrc
4
5# For zsh
6echo 'export PATH=$PATH:$HOME/Android/Sdk/platform-tools' >> ~/.zshrc
7source ~/.zshrc

Option 2: Install via Package Manager

On Linux, you can install ADB directly through your package manager. This automatically handles the PATH setup:

bash
1# Ubuntu/Debian
2sudo apt install android-tools-adb
3
4# Fedora
5sudo dnf install android-tools
6
7# Arch Linux
8sudo pacman -S android-tools

The package manager version may be slightly older than the SDK version, but it is sufficient for most use cases.

Finding Your SDK Path If You Are Not Sure

From Android Studio

  1. Open Android Studio
  2. Go to File then Settings (or Android Studio then Preferences on macOS)
  3. Navigate to Appearance & Behavior then System Settings then Android SDK
  4. The Android SDK Location field shows the path

From the Command Line

bash
1# macOS/Linux: check common locations
2ls ~/Library/Android/sdk/platform-tools/adb 2>/dev/null && echo "Found"
3ls ~/Android/Sdk/platform-tools/adb 2>/dev/null && echo "Found"
4
5# Windows (PowerShell): search for adb.exe
6Get-ChildItem -Path $env:LOCALAPPDATA -Filter adb.exe -Recurse -ErrorAction SilentlyContinue | Select-Object FullName

Using where or which

After fixing your PATH, verify that the system finds the correct ADB:

bash
1# Windows
2where adb
3
4# macOS/Linux
5which adb

Installing ADB Without Android Studio

You do not need the full Android Studio IDE to use ADB. Download just the SDK Platform-Tools:

  1. Go to https://developer.android.com/tools/releases/platform-tools
  2. Download the ZIP for your operating system
  3. Extract to a permanent location (for example, C:\platform-tools or ~/platform-tools)
  4. Add that directory to your PATH using the methods above
bash
1# Example on macOS/Linux after extracting to ~/platform-tools
2echo 'export PATH=$PATH:$HOME/platform-tools' >> ~/.zshrc
3source ~/.zshrc
4adb version

Verifying ADB Works with a Device

After fixing the PATH, test the full connection:

bash
1# Check ADB version
2adb version
3
4# List connected devices
5adb devices
6
7# If your device shows "unauthorized", accept the USB debugging prompt on the device

Expected output when a device is connected:

 
List of devices attached
ABCDEF1234567890	device

If the list is empty:

  • Enable Developer Options on your Android device (tap Build Number 7 times in Settings then About Phone)
  • Enable USB Debugging in Developer Options
  • Connect via USB and accept the debugging authorization popup on the device
  • Try a different USB cable (some cables are charge-only)

Troubleshooting: ADB in PATH But Still Not Working

SymptomCauseFix
adb version works but adb devices is emptyUSB debugging not enabled or cable issueEnable USB debugging, try another cable
adb works in PowerShell but not Command PromptPATH updated for one shell onlyClose and reopen all terminal windows
"ADB server version doesn't match"Multiple ADB installations on PATHRemove old ADB from PATH, keep only latest
adb version shows old versionSystem package manager ADB conflicts with SDK ADBEnsure SDK path comes first in PATH
"error: no devices/emulators found"ADB server crashed or device disconnectedRun adb kill-server then adb start-server
Works in terminal but not in IDEIDE uses its own terminal or PATHRestart the IDE after changing PATH

Fixing Multiple ADB Versions

If you have ADB installed from both the Android SDK and a package manager, they can conflict:

bash
1# See all ADB locations
2# macOS/Linux
3which -a adb
4
5# Windows
6where adb

If multiple paths appear, ensure the newest version is listed first in your PATH, or remove the outdated one.

Common Pitfalls

  • Not opening a new terminal: PATH changes only apply to new terminal sessions. You must close and reopen your terminal (or run source ~/.zshrc) after editing PATH.
  • Adding the SDK root instead of platform-tools: The ADB binary is in platform-tools, not in the SDK root directory. Make sure your PATH entry ends with /platform-tools.
  • Using a backslash in macOS/Linux paths: Paths on macOS and Linux use forward slashes /. Backslashes \ either escape characters or cause errors.
  • Spaces in the SDK path: If your SDK path contains spaces, wrap it in quotes in the export statement: export PATH="$PATH:/path with spaces/platform-tools".
  • Corporate proxies blocking SDK downloads: If you cannot download platform-tools, check if your network blocks dl.google.com. Use a VPN or download the ZIP from another network.
  • Forgetting to restart Android Studio: If ADB was not on PATH when you launched Android Studio, the IDE cached the old PATH. Restart Android Studio after fixing your PATH.

Summary

  • The "'adb' is not recognized" error means the platform-tools directory is not on your system's PATH.
  • On Windows, add the path through Environment Variables or setx. On macOS/Linux, add an export PATH line to your shell profile (.zshrc or .bashrc).
  • You can install ADB standalone without Android Studio by downloading SDK Platform-Tools from the Android developer site.
  • After changing PATH, always open a new terminal and verify with adb version.
  • If adb devices shows empty results, enable USB debugging on your device and check your cable.
  • Use which adb (macOS/Linux) or where adb (Windows) to confirm which ADB binary your system resolves.

Course illustration
Course illustration

All Rights Reserved.