'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:
| OS | Default SDK Location | ADB Path |
| Windows | C:\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)
- Press
Win + Sand search for "Environment Variables" - Click "Edit the system environment variables"
- Click the "Environment Variables" button at the bottom
- Under "User variables" (or "System variables" for all users), select Path and click Edit
- Click New and paste the path to your
platform-toolsdirectory:
- Click OK on all dialogs
- Close all open Command Prompt or PowerShell windows
- Open a new Command Prompt and test:
Method 2: Via Command Line (Permanent for Current User)
Close and reopen your terminal after running this command.
Method 3: Temporary Session Fix
If you just need ADB for the current terminal session:
This resets when you close the terminal.
Fix for macOS: Add ADB to PATH
For zsh (default on macOS Catalina and later)
For bash (older macOS versions)
Fix for Linux: Add ADB to PATH
Option 1: Modify Shell Profile
Option 2: Install via Package Manager
On Linux, you can install ADB directly through your package manager. This automatically handles the PATH setup:
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
- Open Android Studio
- Go to File then Settings (or Android Studio then Preferences on macOS)
- Navigate to Appearance & Behavior then System Settings then Android SDK
- The Android SDK Location field shows the path
From the Command Line
Using where or which
After fixing your PATH, verify that the system finds the correct ADB:
Installing ADB Without Android Studio
You do not need the full Android Studio IDE to use ADB. Download just the SDK Platform-Tools:
- Go to
https://developer.android.com/tools/releases/platform-tools - Download the ZIP for your operating system
- Extract to a permanent location (for example,
C:\platform-toolsor~/platform-tools) - Add that directory to your PATH using the methods above
Verifying ADB Works with a Device
After fixing the PATH, test the full connection:
Expected output when a device is connected:
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
| Symptom | Cause | Fix |
adb version works but adb devices is empty | USB debugging not enabled or cable issue | Enable USB debugging, try another cable |
adb works in PowerShell but not Command Prompt | PATH updated for one shell only | Close and reopen all terminal windows |
| "ADB server version doesn't match" | Multiple ADB installations on PATH | Remove old ADB from PATH, keep only latest |
adb version shows old version | System package manager ADB conflicts with SDK ADB | Ensure SDK path comes first in PATH |
| "error: no devices/emulators found" | ADB server crashed or device disconnected | Run adb kill-server then adb start-server |
| Works in terminal but not in IDE | IDE uses its own terminal or PATH | Restart 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:
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-toolsdirectory is not on your system's PATH. - On Windows, add the path through Environment Variables or
setx. On macOS/Linux, add anexport PATHline to your shell profile (.zshrcor.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 devicesshows empty results, enable USB debugging on your device and check your cable. - Use
which adb(macOS/Linux) orwhere adb(Windows) to confirm which ADB binary your system resolves.

