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

Learn 'adb' is not recognized as an internal or external command, operable program or batch file with practical examples, diagrams, and best practices. Covers android, batch-file, adb development t...

'adb' is not recognized: Troubleshooting Android Debug Bridge Command Not Found

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

Learn how to fix the common 'adb' command not recognized error on Windows, macOS, and Linux by correctly setting up your Android SDK platform tools path.

Encountering the error message "'adb' is not recognized as an internal or external command, operable program or batch file" is a common frustration for Android developers and users trying to interact with their devices via the Android Debug Bridge (ADB). This usually means your operating system cannot find the adb executable in its defined system paths. This article will guide you through the necessary steps to resolve this issue across different operating systems.

Understanding the 'adb' Command Not Found Error

The Android Debug Bridge (ADB) is a versatile command-line tool that lets you communicate with an emulator instance or connected Android device. It's part of the Android SDK Platform-Tools package. When your system reports that adb is not recognized, it simply means that the directory containing the adb.exe (Windows) or adb (macOS/Linux) file is not included in your system's PATH environment variable. The PATH variable tells your operating system where to look for executable programs when you type a command in the terminal or command prompt.

flowchart TD
    A[User types 'adb' in terminal]
    B{Is 'adb' in PATH environment variable?}
    C[System searches PATH directories]
    D[Executable found]
    E[Command executed]
    F[Executable not found]
    G["'adb' is not recognized" error]

    A --> B
    B -- Yes --> C
    C --> D
    D --> E
    B -- No --> F
    F --> G

Flowchart illustrating the process of command execution and the 'not recognized' error.

Step 1: Install Android SDK Platform-Tools

Before you can add adb to your PATH, you need to ensure it's actually installed on your system. The adb executable is part of the Android SDK Platform-Tools. If you have Android Studio installed, these tools are usually downloaded automatically. If not, or if you prefer a standalone installation, you can download them directly.

1. Download Platform-Tools

Visit the official Android Developers website to download the latest Android SDK Platform-Tools package for your operating system. The download will be a ZIP archive.

2. Extract the Archive

Extract the contents of the downloaded ZIP file to a memorable and easily accessible location on your computer. A common practice is to create a folder like C:\Android\sdk\platform-tools on Windows, or ~/Android/sdk/platform-tools on macOS/Linux. Make sure the platform-tools folder itself contains the adb executable.

Step 2: Add 'adb' to Your System's PATH Environment Variable

This is the crucial step that tells your operating system where to find the adb command. The process varies slightly depending on your OS.

Windows

  1. Search for "Environment Variables" in the Windows search bar and select "Edit the system environment variables."
  2. In the System Properties window, click the "Environment Variables..." button.
  3. Under "System variables," find the Path variable and select it, then click "Edit."
  4. In the "Edit environment variable" window, click "New" and add the full path to your platform-tools directory (e.g., C:\Android\sdk\platform-tools).
  5. Click "OK" on all open windows to save the changes.
  6. Important: Close and reopen any Command Prompt or PowerShell windows for the changes to take effect.

macOS / Linux

  1. Open your terminal.
  2. Determine your shell. Most modern macOS/Linux systems use Zsh or Bash. You can check with echo $SHELL.
  3. Edit your shell's configuration file:
    • For Zsh: nano ~/.zshrc
    • For Bash: nano ~/.bash_profile (macOS) or nano ~/.bashrc (Linux)
  4. Add the following line to the end of the file, replacing /path/to/your/platform-tools with the actual path where you extracted the platform-tools folder: export PATH=$PATH:/path/to/your/platform-tools
  5. Save the file (Ctrl+O, then Enter for nano) and exit the editor (Ctrl+X for nano).
  6. Apply the changes by sourcing the file:
    • For Zsh: source ~/.zshrc
    • For Bash: source ~/.bash_profile or source ~/.bashrc
  7. Important: Close and reopen your terminal for the changes to take full effect.

Step 3: Verify the Installation

After modifying your PATH environment variable, it's essential to verify that the system can now recognize the adb command.

1. Open a New Terminal/Command Prompt

Ensure you open a completely new terminal or command prompt window. Existing windows might not pick up the updated PATH variable.

2. Run the 'adb version' Command

Type adb version and press Enter. If the setup was successful, you should see output similar to this, indicating the ADB version:

Android Debug Bridge version 1.0.41
Version 34.0.5-10900879
Installed as C:\Android\sdk\platform-tools\adb.exe

If you still get the "not recognized" error, double-check your path entry for typos and ensure you've restarted your terminal.

Troubleshooting Common Issues

If you're still facing problems, consider these common pitfalls:

  1. Typos in the Path: Even a small typo in the directory path or the environment variable name can prevent it from working. Double-check every character.
  2. Incorrect Directory: Ensure you're pointing to the platform-tools directory itself, not a parent directory or a subdirectory within platform-tools.
  3. Not Restarting Terminal: This is a very common mistake. Environment variable changes are usually applied to new processes, so existing terminal windows won't see them.
  4. Multiple Android SDK Installations: If you have multiple Android SDKs, ensure your PATH points to the platform-tools of the SDK you intend to use.
  5. Permissions: On Linux/macOS, ensure the adb executable has execute permissions (chmod +x /path/to/your/platform-tools/adb). This is rarely an issue if downloaded from the official source, but worth checking.
adb devices

After successful setup, use adb devices to list connected devices.