Troubleshooting

zsh: command not found: adb? Put Android Platform-Tools on your PATH

adb ships in Android SDK Platform-Tools. Fix zsh: command not found: adb on macOS, Windows and Linux with the SDK path, Homebrew, winget or apt.

Published ~8 min read
On this page

Short answer

adb ships in Android SDK Platform-Tools, and Android Studio leaves PATH to you. zsh: command not found: adb means Platform-Tools is not installed, or its platform-tools folder is not on PATH. With Android Studio on a Mac, add ~/Library/Android/sdk/platform-tools to PATH. Without Studio, run brew install --cask android-platform-tools, winget install Google.PlatformTools or sudo apt install adb.

Where to start

Check what the shell can see

Ask the shell first. These lines work in bash and zsh and change nothing. The last one looks in the folders where Android Studio puts adb on a Mac and on Linux:

bash · zsh
command -v adb               # path of the adb this shell would run
type -a adb                  # every adb on PATH, plus aliases and functions
echo "$PATH" | tr ':' '\n'   # the folders it searches, in order
ls ~/Library/Android/sdk/platform-tools/adb ~/Android/Sdk/platform-tools/adb 2>/dev/null
  • No path, but the ls line finds a file: adb is installed and only the PATH entry is missing. Go to the SDK folder.
  • No path and no file: Platform-Tools is not installed, or Studio keeps its SDK somewhere else. Check Studio’s SDK location or install Platform-Tools for your system below.
  • A path, but adb still misbehaves: type -a adb may list two copies, and the first one wins. See keep one copy.

On one of our Debian 12 servers, without adb, bash and sh answer like this, both with exit status 127:

output · Debian 12
$ bash -c 'adb version'
bash: line 1: adb: command not found
$ sh -c 'adb version'
sh: 1: adb: not found
$ echo $?
127

In an interactive bash the message reads bash: adb: command not found, zsh on a Mac prints zsh: command not found: adb, and Windows has two versions:

Windows
# Windows PowerShell 5.1
adb : The term 'adb' is not recognized as the name of a cmdlet, function, script file, or operable program.

# PowerShell 7
adb: The term 'adb' is not recognized as a name of a cmdlet, function, script file, or executable program.

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

All of them mean the shell searched every folder on PATH and found no adb. What the number 127 means in scripts and CI logs is in exit code 127.

Android Studio is installed: put platform-tools on PATH

Android Studio installs Platform-Tools into its SDK folder and keeps it updated. To run adb from a terminal without typing the full path, Google’s docs tell you to add the SDK’s platform-tools folder to PATH yourself. These are the default SDK locations they give:

SystemSDK folderadb
macOS~/Library/Android/sdk~/Library/Android/sdk/platform-tools/adb
Windows%LOCALAPPDATA%\Android\Sdk%LOCALAPPDATA%\Android\Sdk\platform-tools\adb.exe
Linux~/Android/Sdk~/Android/Sdk/platform-tools/adb

If the folder is not there, check two things in Android Studio. The real path is the Android SDK Location under Settings (Preferences on macOS) > Appearance & Behavior > System Settings > Android SDK (or type Android SDK into the Settings search). And in the SDK Manager’s SDK Tools tab, Android SDK Platform Tools must be ticked; that package is the one that contains adb.

The PATH lines for zsh and bash

Google’s environment variable page sets ANDROID_HOME to the SDK folder and adds $ANDROID_HOME/platform-tools to PATH. For zsh, the default shell on macOS, put these two lines at the end of ~/.zshrc:

~/.zshrc (macOS)
export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH="$PATH:$ANDROID_HOME/platform-tools"

For bash on Linux, the same idea in ~/.bashrc with the Linux folder:

~/.bashrc (Linux)
export ANDROID_HOME="$HOME/Android/Sdk"
export PATH="$PATH:$ANDROID_HOME/platform-tools"

Then run source ~/.zshrc (or source ~/.bashrc) or open a new terminal, and try adb version. Google’s own example uses ~/.zprofile for zsh and ~/.bash_profile for bash, which only login shells read. macOS Terminal opens login shells, so ~/.zprofile works there too; on Linux, where a terminal window usually starts a non-login bash, ~/.bashrc is the safer place. Google’s line also adds tools and tools/bin, which adb does not need. ANDROID_SDK_ROOT, the older name for ANDROID_HOME, is deprecated. More on startup files and permanent variables in how to set environment variables on Linux.

macOS without Android Studio: Homebrew or the zip

If you only need adb and fastboot, Homebrew has Platform-Tools as a cask. Its token is android-platform-tools, and on 8 November 2026 it was at 37.0.2:

macOS · Homebrew
brew install --cask android-platform-tools
adb version

The cask links adb, fastboot and a few smaller tools into Homebrew’s bin folder: /opt/homebrew/bin on Apple Silicon, /usr/local/bin on an Intel Mac. On Apple Silicon that folder is only on PATH once Homebrew’s shellenv line is in ~/.zprofile:

~/.zprofile (Apple Silicon)
eval "$(/opt/homebrew/bin/brew shellenv)"

The other route is Google’s standalone download, platform-tools-latest-darwin.zip from the SDK Platform-Tools page. It unpacks into a folder named platform-tools; move that somewhere permanent, such as your home folder, and add it to PATH like the SDK folder above. Google’s download links always point at the newest release.

Keep one copy. With Android Studio and the cask both installed, type -a adb lists two, and the one in the earlier PATH folder wins. Google notes that Studio updates its own copy automatically, so if you have Studio, its copy is the easy one to keep.

Windows: PATH, winget or the zip

With Android Studio, adb is in %LOCALAPPDATA%\Android\Sdk\platform-tools. Add that folder to your user PATH, no admin rights needed:

PowerShell · user PATH
$pt = "$env:LOCALAPPDATA\Android\Sdk\platform-tools"
Test-Path "$pt\adb.exe"       # must say True
$user = [Environment]::GetEnvironmentVariable('Path', 'User')
[Environment]::SetEnvironmentVariable('Path', "$user;$pt", 'User')

If Test-Path says False, look up the real folder under Android SDK Location in Studio’s settings, as above. Then close every terminal and open a new one: a PATH change only reaches programs started after it, and an editor’s built-in terminal keeps the old PATH until the editor restarts.

Without Android Studio, winget installs Platform-Tools directly:

PowerShell · cmd
winget install --id Google.PlatformTools -e
# open a new terminal, then
adb version

Its manifest in Microsoft’s winget-pkgs repository installs Google’s zip as a portable package with adb and fastboot as commands; version 37.0.2 was the newest on 8 November 2026. Open a new terminal before you try it. The manual route is platform-tools-latest-windows.zip: unzip it and add the platform-tools folder inside to PATH with the lines above.

Typing adb inside the platform-tools folder is not the same as having it on PATH. PowerShell does not run programs from the current folder unless you write .\adb, so even there plain adb fails until the folder is on PATH.

Linux: the SDK folder or apt install adb

With Android Studio on Linux, the SDK sits in ~/Android/Sdk; use the ~/.bashrc lines above. Without Studio, Debian and Ubuntu package adb on its own. On our Debian 12 server apt shows two versions:

output · Debian 12
$ apt-cache policy adb
adb:
  Installed: (none)
  Candidate: 1:29.0.6-28
  Version table:
     1:34.0.5-12~bpo12+1 100
        100 mirror+file:/etc/apt/mirrors/debian.list bookworm-backports/main amd64 Packages
     1:29.0.6-28 500
        500 mirror+file:/etc/apt/mirrors/debian.list bookworm/main amd64 Packages
$ apt-cache show adb | grep -E '^(Package|Version|Provides|Homepage):'
Package: adb
Version: 1:34.0.5-12~bpo12+1
Provides: android-tools-adb
Homepage: https://developer.android.com/studio/releases/platform-tools
Package: adb
Version: 1:29.0.6-28
Provides: android-tools-adb
Homepage: https://developer.android.com/studio/releases/platform-tools

A plain install takes the candidate, 29.0.6 from bookworm itself. The backports build, 34.0.5, needs bookworm-backports in your apt sources and has to be asked for by name:

Debian 12
sudo apt install adb                          # 29.0.6
sudo apt install -t bookworm-backports adb    # 34.0.5, with backports enabled
sudo apt install fastboot                     # fastboot is a separate package

Ubuntu uses the same package name, sudo apt install adb. The package puts the command in /usr/bin/adb, which is on every PATH. Newer releases ship newer builds:

Releaseadb packageChecked with
Debian 1229.0.6 (backports: 34.0.5)apt-cache on our server
Debian 1334.0.5packages.debian.org
Ubuntu 24.04 LTS34.0.4packages.ubuntu.com
Ubuntu 26.04 LTS34.0.5packages.ubuntu.com
Google Platform-Tools37.0.1 (July 2026), 37.0.2 in canarydeveloper.android.com

All distribution builds are older than Google’s current 37 line. That matters for newer features: when wireless debugging fails, Google’s troubleshooting steps ask for adb server-status to report version 37.0.0 or higher. If you need that, use platform-tools-latest-linux.zip from Google and add its platform-tools folder to PATH instead.

Installed, but this terminal still says command not found

A shell reads its startup files once, when it starts. A terminal that was open before you changed ~/.zshrc or installed adb keeps its old PATH. Two ways out:

  • Reload the file: source ~/.zshrc or source ~/.bashrc, or simply open a new terminal window.
  • Clear the command cache: shells remember where they last found each command. After installing, moving or removing adb, run rehash in zsh or hash -r in bash so the shell searches PATH again.

If it still fails, check the PATH line for the usual slips: a line without $PATH in it throws away every other folder, a macOS line copied to Linux points at a folder that does not exist there (Linux uses ~/Android/Sdk, with a capital S, and case matters), and lines in ~/.bashrc never reach zsh.

adb runs, but says no devices/emulators found

Then PATH is fine and the command was found; the problem is the connection to the phone or emulator. A few starting points from Google’s adb docs:

  • Turn on USB debugging in Developer options. On Android 4.2 and higher that screen is hidden until you enable it.
  • Unlock the phone and accept the dialog that asks whether to allow debugging from this computer (Android 4.2.2 and higher).
  • On Windows, Google devices need the Google USB Driver from the SDK Manager; other brands need their maker’s driver.
  • Run adb devices. It prints List of devices attached and one line per device; offline means the device is not responding. adb kill-server resets the connection.

Check that it works

bash · zsh · PowerShell
command -v adb      # PowerShell: Get-Command adb
adb version
adb devices

The first line names the adb this shell runs, for example a path under ~/Library/Android/sdk/platform-tools, /opt/homebrew/bin/adb or /usr/bin/adb. adb version prints the version instead of the error, and adb devices shows whether the phone or emulator is connected. Repeat the check in a new terminal and, if you use one, in your editor’s terminal.

Hitting the same error with another developer tool? The pattern is always the folder and PATH: see npm: command not found and python: command not found.

How we tested

OS image
Debian 12 (bookworm)
Versions
GNU bash 5.2.15dash 0.5.12 (/bin/sh)apt: adb 1:29.0.6-28 and 1:34.0.5-12~bpo12+1
Tested on
Where
One of our own Debian 12 servers, without adb or an Android SDK
Method
Run as shown: apt-cache policy and apt-cache show for adb, command -v and type -a, the not-found messages of bash and sh with exit status 127, and the secure_path line read from /etc/sudoers; nothing was installed and sudo was not run
From vendor sources, not run
SDK Platform-Tools release notes, adb, environment variables, SDK Manager, emulator archive and Windows configuration pages (developer.android.com), the Homebrew android-platform-tools cask, the Google.PlatformTools manifest in winget-pkgs, Debian and Ubuntu package pages, PowerShell command precedence (learn.microsoft.com), all read 2026-11-08

Frequently asked

Why does zsh say command not found: adb on my Mac?

adb is part of Android SDK Platform-Tools, and Android Studio leaves PATH to you. Add export PATH="$PATH:$HOME/Library/Android/sdk/platform-tools" to ~/.zshrc, then run source ~/.zshrc or open a new terminal. Without Android Studio, install it with brew install --cask android-platform-tools.

Where does Android Studio install adb?

In the platform-tools folder of the Android SDK. The defaults are ~/Library/Android/sdk/platform-tools on macOS, %LOCALAPPDATA%\Android\Sdk\platform-tools on Windows and ~/Android/Sdk/platform-tools on Linux. The real path is the Android SDK Location under Settings > Appearance & Behavior > System Settings > Android SDK.

How do I fix 'adb' is not recognized on Windows?

Add %LOCALAPPDATA%\Android\Sdk\platform-tools to your user Path, or install Platform-Tools with winget install --id Google.PlatformTools -e, then close every terminal and open a new one. PowerShell does not run adb from the current folder unless you type .\adb.

Can I install adb with apt on Debian or Ubuntu?

Yes: sudo apt install adb puts it in /usr/bin/adb. Debian 12 ships 29.0.6, or 34.0.5 from bookworm-backports, and Ubuntu 26.04 ships 34.0.5. Google's Platform-Tools are at 37, so for the newest adb download platform-tools-latest-linux.zip and add its platform-tools folder to PATH.

Related articles

All troubleshooting