How to Fix “‘adb’ is not recognized as an internal or external command”

Stephen NdegwaStephen Ndegwa
·
5 min read

If you’re seeing this error when trying to use Android Debug Bridge (ADB), it means your system can’t find the ADB executable. This comprehensive guide will walk you through understanding the problem and multiple solutions to fix it.

Understanding the Problem

ADB (Android Debug Bridge) is a command-line tool that’s part of the Android SDK Platform Tools. The error occurs because:

  1. ADB isn’t installed on your system
  2. ADB is installed but not in your system’s PATH environment variable
  3. You’re running the command from the wrong directory

Solution 1: Install Android SDK Platform Tools

If you haven’t installed ADB yet, this is your first step.

For Windows:

Download the official Platform Tools from Google. Visit the Android Developer website and download the SDK Platform Tools ZIP file for Windows. Extract the ZIP file to a location you’ll remember, such as C:\platform-tools or C:\Android\platform-tools. The extracted folder contains adb.exe along with other tools like fastboot.exe.

For macOS:

The easiest method is using Homebrew. Open Terminal and run brew install android-platform-tools. If you don’t have Homebrew, install it first from brew.sh, or download the Platform Tools manually from the Android Developer website and extract them to a location like /Users/YourUsername/platform-tools.

For Linux:

Most distributions allow installation through package managers. On Ubuntu/Debian, use sudo apt-get update followed by sudo apt-get install android-tools-adb android-tools-fastboot. On Fedora, use sudo dnf install android-tools. Alternatively, download the Linux version from the Android Developer website.

Solution 2: Add ADB to Your System PATH

This is the most common solution and allows you to run ADB from any directory.

Windows Method:

Press Windows key + R, type sysdm.cpl, and press Enter to open System Properties. Click the “Advanced” tab, then click “Environment Variables” at the bottom. In the System variables section (or User variables if you prefer), find and select the “Path” variable, then click “Edit”. Click “New” and add the full path to your platform-tools folder, for example C:\platform-tools. Click OK on all windows to save your changes. Close and reopen any Command Prompt or PowerShell windows for the changes to take effect.

To verify it worked, open a new Command Prompt and type adb version. You should see version information instead of an error.

macOS/Linux Method:

Open Terminal and determine which shell you’re using by typing echo $SHELL. For bash, edit ~/.bash_profile or ~/.bashrc. For zsh (default on newer macOS), edit ~/.zshrc.

Add this line to the appropriate file: export PATH=$PATH:/path/to/your/platform-tools (replace with your actual path). Save the file and reload it by running source ~/.zshrc (or the appropriate file for your shell).

Verify by typing adb version in a new Terminal window.

Solution 3: Use ADB Without Adding to PATH

If you don’t want to modify your PATH, you can use ADB directly.

Navigate to the platform-tools folder in your terminal or command prompt using the cd command, for example cd C:\platform-tools on Windows or cd ~/platform-tools on macOS/Linux. Run ADB commands with .\adb on Windows or ./adb on macOS/Linux.

Alternatively, use the full path every time, like C:\platform-tools\adb.exe devices on Windows or /Users/YourUsername/platform-tools/adb devices on macOS.

Solution 4: Installing via Android Studio

If you use Android Studio, ADB comes bundled with it.

The SDK location is typically at C:\Users\YourUsername\AppData\Local\Android\Sdk\platform-tools on Windows, /Users/YourUsername/Library/Android/sdk/platform-tools on macOS, or /home/YourUsername/Android/Sdk/platform-tools on Linux.

You can verify the SDK location in Android Studio by going to File → Settings (or Android Studio → Preferences on macOS) → Appearance & Behavior → System Settings → Android SDK. Add this platform-tools path to your system PATH using the methods described above.

Troubleshooting Common Issues

ADB still not recognized after adding to PATH: Make sure you completely closed and reopened your terminal or command prompt. Environment variable changes don’t apply to already-open windows. Verify the path you added is correct with no typos.

Permission denied errors on macOS/Linux: You may need to make the ADB file executable by running chmod +x ~/platform-tools/adb (adjust path as needed).

Multiple ADB versions causing conflicts: If you have ADB installed in multiple locations, you might encounter version conflicts. Check which ADB is being used with where adb on Windows or which adb on macOS/Linux. Consider removing duplicate installations.

Antivirus blocking ADB: Some antivirus software flags ADB as suspicious. Add an exception for the platform-tools folder in your antivirus settings.

Verifying Your Installation

Once you’ve completed the setup, verify everything works by running these commands:

adb version should display the ADB version information. adb devices should show “List of devices attached” (your device will appear here if connected). If you see “adb server is out of date” or similar messages, run adb kill-server followed by adb start-server.

Best Practices

Keep your Platform Tools updated by periodically downloading the latest version from Google. Remember that ADB requires USB debugging to be enabled on your Android device (Settings → Developer Options → USB Debugging). Always download Platform Tools from official sources to avoid malware or compromised versions.

By following these solutions, you should have ADB working properly on your system. The PATH method is recommended as it provides the most convenient experience, allowing you to use ADB commands from anywhere on your system.

Share:

Related Tutorials

How to Use Claude Code with AWS Bedrock

This guide shows how to run Claude Code using Anthropic models hosted on Amazon Bedrock, instead of Anthropic’s direct API. Overview Claude Code supports Amazon Bedrock as a backend. When enabled, it: Prerequisites 1. AWS Account with Bedrock Enabled 👉 AWS Bedrock Consolehttps://console.aws.amazon.com/bedrock/ Important: The first time you use Anthropic models, AWS requires you to […]

Stephen Ndegwa
·

How to Enable ICMP (Ping) on Windows Public Firewall

This guide explains how to allow ICMP (Ping) traffic on a Windows machine using the Public firewall profile. This is useful for network troubleshooting, monitoring, and connectivity testing. ⚠️ Important: This only makes the Windows host pingable. It does not affect routers, public IPs on firewalls (e.g. MikroTik), or tunnel brokers like Hurricane Electric if […]

Stephen Ndegwa
·

How to Run Claude Code with Gemini, OpenAI, or Anthropic Models

How to Run Claude Code with Gemini, OpenAI, or Anthropic Models via claude-code-proxy (Windows, macOS, Linux) The AI ecosystem is evolving fast, and many developers want to leverage Claude Code, Anthropic’s client, with different backends like Google Gemini, OpenAI, or Anthropic itself. claude-code-proxy is a lightweight proxy server that allows you to connect Claude Code […]

Stephen Ndegwa
·