Troubleshooting

zsh: command not found: uv? Install uv and put ~/.local/bin on your PATH

uv is not part of Python or pip. Fix zsh: command not found: uv after the installer, with Homebrew, pipx or winget, and get uvx and PATH right.

Published ~8 min read
On this page

Short answer

uv is Astral’s Python package manager, a separate program that neither Python nor pip brings along. zsh: command not found: uv means it is not installed, or the installer put it in ~/.local/bin and the shell you typed into has not loaded the new PATH yet. Install it, then run source $HOME/.local/bin/env or open a new terminal.

Where to start

Check what the shell can see

Before installing anything, ask the shell whether a uv exists and where it looks. These lines work in bash and zsh and change nothing:

bash · zsh
command -v uv uvx                         # where this shell finds them, if at all
ls -l ~/.local/bin/uv ~/.cargo/bin/uv     # today's install folder and the old one
echo "$PATH" | tr ':' '\n'                # the folders it searches, in order

On one of our Debian 12 servers, where uv is not installed, bash and sh answer like this for both commands, and all of them exit with status 127:

output · Debian 12
$ env -i PATH=/usr/local/bin:/usr/bin:/bin bash -c 'uv --version'; echo $?
bash: line 1: uv: command not found
127
$ env -i PATH=/usr/local/bin:/usr/bin:/bin sh -c 'uv --version'; echo $?
sh: 1: uv: not found
127
$ env -i PATH=/usr/local/bin:/usr/bin:/bin bash -c 'uvx --version'; echo $?
bash: line 1: uvx: command not found
127

An interactive bash says bash: uv: command not found, zsh (the default shell on macOS) says zsh: command not found: uv, and PowerShell says The term 'uv' is not recognized as the name of a cmdlet, function, script file, or operable program. All of them mean that no folder on PATH holds uv; the 127 is explained in exit code 127. What the checks above tell you:

  • ls finds ~/.local/bin/uv, command -v does not: uv is installed and PATH is the problem. Go to the next steps.
  • Only ~/.cargo/bin/uv exists: an install from before uv 0.5.0, see the old cargo folder.
  • Neither file exists: uv is not installed. Install it.

Install uv

uv is not part of Python and not part of pip. It is a program written in Rust, and Astral’s documentation says it installs without Rust or Python being present. The standalone installer is the method the docs list first:

macOS · Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# without curl
wget -qO- https://astral.sh/uv/install.sh | sh
# read the script before you run it
curl -LsSf https://astral.sh/uv/install.sh | less

We read the script that address served on 8 November 2026 (it installs uv 0.13.7). This is what it does with your PATH:

  • It puts uv and uvx in the first of $XDG_BIN_HOME, $XDG_DATA_HOME/../bin and $HOME/.local/bin. Unless you have set one of those variables, that means ~/.local/bin. UV_INSTALL_DIR picks another folder.
  • It writes a small script, $HOME/.local/bin/env (plus env.fish for fish), that adds the folder to PATH only if it is not there yet.
  • It adds the line . "$HOME/.local/bin/env" to ~/.profile (creating the file if needed), to each of ~/.bashrc, ~/.bash_profile and ~/.bash_login that exists, and to ~/.zshrc, or to ~/.zshenv when only that one exists. For fish it writes ~/.config/fish/conf.d/uv.env.fish.
  • It skips all of that when the folder is already on your PATH, or when you set UV_NO_MODIFY_PATH=1.

Installed a minute ago, still not found

The installer runs in its own sh process, and a child process cannot change the PATH of the shell that started it. The terminal you pasted the command into keeps its old PATH, so the very next uv --version fails. When the script has edited your profile files, its last lines say exactly that:

end of the installer's message
To add $HOME/.local/bin to your PATH, either restart your shell or run:

    source $HOME/.local/bin/env (sh, bash, zsh)
    source $HOME/.local/bin/env.fish (fish)

Do one of the two:

bash · zsh
source $HOME/.local/bin/env    # fixes this shell only
uv --version

or close the terminal and open a new one, which reads the files the installer just edited. On Debian a fresh login helps for a second reason: the default ~/.profile from /etc/skel puts ~/.local/bin on PATH, but only if the folder already exists when you log in, and before the install it often did not.

New terminals still say command not found

Then the line is not in a file your shell reads. That happens when you installed with UV_NO_MODIFY_PATH=1, when ~/.local/bin was already on PATH in the shell that ran the installer (it then edits nothing), or when a file such as ~/.bash_profile was created after the install. Which file counts depends on the shell and on how it was started:

ShellReads at startPut the PATH line in
zsh (default on macOS)~/.zshenv always, ~/.zprofile in login shells, ~/.zshrc in interactive shells~/.zshrc
bash, login shell (SSH, a Linux console)/etc/profile, then the first of ~/.bash_profile, ~/.bash_login, ~/.profile~/.bash_profile if it exists, else ~/.profile
bash, new terminal window on a Linux desktop~/.bashrc~/.bashrc
fish~/.config/fish/conf.d/*.fishthe installer’s uv.env.fish is already there

The bash login row hides the trap: as soon as a ~/.bash_profile exists, a bash login shell never reads ~/.profile. Add one of these lines to the file from the table:

~/.zshrc · ~/.bashrc · ~/.bash_profile
# load uv's env script ...
. "$HOME/.local/bin/env"

# ... or put the folder on PATH yourself
export PATH="$HOME/.local/bin:$PATH"

Open a new terminal afterwards. uv can also do it for you: Astral’s docs name uv tool update-shell for putting the tool folder on PATH, and that folder defaults to the same ~/.local/bin. Because uv is not found yet, call it with its full path: ~/.local/bin/uv tool update-shell. More on making PATH changes stick is in how to set environment variables on Linux.

Homebrew, pipx, pip and other methods

Astral documents several other ways in. Each puts uv somewhere else:

MethodCommandWhere uv ends up
Homebrew (macOS, Linux)brew install uvHomebrew's bin folder, so brew itself must be on PATH
MacPortssudo port install uvthe MacPorts bin folder
pipxpipx install uv~/.local/bin; pipx ensurepath puts it on PATH
pip into a venvpython3 -m venv .venv && .venv/bin/pip install uv (on Debian and Ubuntu first sudo apt install python3-venv).venv/bin/uv, on PATH only while the venv is active
Cargocargo install --locked uvbuilds from source and needs a Rust toolchain
Docker imageCOPY --from=ghcr.io/astral-sh/uv:0.13.7 /uv /uvx /bin//bin in your image

Plain pip install uv on Debian 12 runs into error: externally-managed-environment, because the system Python is protected; that is why the table uses a venv or pipx. Details are in pip: command not found, and if python3 itself is missing, start with python: command not found.

Windows: the term ‘uv’ is not recognized

PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# or
winget install --id=astral-sh.uv -e
scoop install main/uv

The PowerShell installer follows the same folder rule as on Linux: the first of %XDG_BIN_HOME%, %XDG_DATA_HOME%\..\bin and %USERPROFILE%\.local\bin, so normally C:\Users\you\.local\bin, which then holds uv.exe, uvx.exe and uvw.exe. A terminal that was open during the install keeps its old PATH, so close every terminal (and restart VS Code if you use its built-in one) and check in a new one:

PowerShell
Get-Command uv                                  # where PowerShell finds it
Test-Path "$env:USERPROFILE\.local\bin\uv.exe"   # True means the file is there

If Test-Path says True and Get-Command still finds nothing, add that folder to your user PATH and open a new terminal.

Debian 12 has no uv package

apt install uv does not work on Debian 12. On our server, with bookworm, bookworm-updates, bookworm-security and bookworm-backports configured, apt has never heard of the name:

output · Debian 12
$ apt-cache policy uv
$ apt-cache show uv
E: No packages found

apt-cache policy prints nothing at all for a name it does not know. On 8 November 2026 Debian’s package search found no package named uv in any release either, so use the standalone installer or pipx on Debian 13 as well. Elsewhere:

  • Ubuntu has a uv package only from 26.10 on; the 24.04 and 26.04 LTS releases do not.
  • Fedora 43 and later and EPEL 10 have one: sudo dnf install uv. EPEL 9 does not.
  • Alpine has one in its community repository (apk add uv), at 0.11.19 in the 3.24 branch.

Distribution packages trail Astral’s releases (the installer is at 0.13.7), as that Alpine version shows, and they cannot use uv self update.

uv works, uvx does not

uvx is not a separate package. Astral’s docs call it an alias for uv tool run, and the standalone installer puts the uvx executable next to uv. If uv runs and uvx does not, look into the same folder, and use the long form in the meantime:

bash · zsh
ls "$(dirname "$(command -v uv)")"   # uvx should sit next to uv
uv tool run ruff --version            # the same as: uvx ruff --version

If the folder has no uvx, reinstall with the standalone installer, which gives you both. The same PATH logic covers tools: a command you added with uv tool install lands in the same executable folder, uv prints a warning when that folder is not on PATH, and uv tool update-shell fixes it.

Works in your shell, fails under sudo or cron

The installer puts uv in your home directory, and only your own shell knows about it. sudo replaces PATH with secure_path from /etc/sudoers, which on our Debian server is /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin, so sudo uv answers sudo: uv: command not found. Root has its own home as well, and /root/.local/bin is not yours. uv rarely needs root; when a command really does, give the full path:

bash · zsh
sudo "$HOME/.local/bin/uv" --version   # your shell expands $HOME before sudo runs

cron and systemd units read none of ~/.bashrc, ~/.zshrc or ~/.profile. Write the full path there too, for example /home/you/.local/bin/uv run script.py, or set a literal PATH line at the top of the crontab; cron does not expand variables in it.

Two more traps

An old uv in ~/.cargo/bin

Before 0.5.0 the installer used ~/.cargo/bin. Astral’s docs note that upgrading does not remove the binaries there, so they have to go by hand. If ~/.cargo/bin comes first on your PATH, the old uv wins:

bash · zsh
type -a uv              # every uv on PATH, in order
ls ~/.cargo/bin         # remove uv and uvx here if they are the old copies
hash -r                 # bash forgets old locations; in zsh: rehash

A custom folder or UV_NO_MODIFY_PATH

With UV_NO_MODIFY_PATH=1 the installer leaves your profiles alone for good: the docs say later operations such as uv self update will not edit them either. The PATH line is then yours to add. UV_INSTALL_DIR moves uv, uvx and the env script; the installer still edits your profiles for that folder, so run source <folder>/env. Cache, tools and Python installs stay in their default locations.

Confirm it works

bash · zsh
command -v uv uvx     # both print a path, normally in ~/.local/bin
uv --version
uv self update        # standalone installs only

If uv self update says self-update is only available for the standalone installer, or that uv was installed through an external package manager, update it there. Astral pitches uv as one tool in place of pip, pipx, virtualenv, poetry and pyenv, so once it runs, see how to check the Python version to know which interpreter a project gets.

Running Python projects on a server? Our Standard KVM plans run Debian or Ubuntu with full root access, and the standalone installer puts uv in your own home without needing root at all.

How we tested

OS image
Debian 12 (bookworm)
Versions
GNU bash 5.2.15dash (/bin/sh)apt 2.6.2Debian 12.15
Tested on
Where
One of our own Debian 12 servers, without uv
Method
Only the not-found messages of bash and sh for uv and uvx (exit status 127) and apt-cache policy uv and apt-cache show uv were run as shown. Nothing was installed; the install script was read, not run.
From vendor sources, not run
Astral's uv docs on docs.astral.sh/uv (installation, installer and storage reference, tools guide, Docker guide) and the installer script served on 2026-11-08 (uv 0.13.7), the GNU bash and zsh manuals on startup files, Debian and Ubuntu package search, the Fedora package database, the Alpine package index (all read 2026-11-08)

Frequently asked

Why does zsh say command not found: uv right after installing it?

The standalone installer puts uv and uvx in ~/.local/bin and adds a line to your shell files, but it runs in its own process and cannot change the PATH of the terminal you ran it from. Run source $HOME/.local/bin/env in that terminal, or open a new one, then check with command -v uv.

Where does the uv installer put the uv binary?

In the first of $XDG_BIN_HOME, $XDG_DATA_HOME/../bin and $HOME/.local/bin, which on most systems means ~/.local/bin, with uvx next to it. On Windows it is %USERPROFILE%\.local\bin. Before uv 0.5.0 the installer used ~/.cargo/bin, and upgrading does not remove the old copies there.

Can I install uv with apt on Debian?

Not on Debian 12: apt-cache policy uv prints nothing and apt-cache show uv says E: No packages found, and Debian's package search lists no uv package in any release. Use the standalone installer or pipx install uv. Ubuntu packages uv from 26.10, current Fedora releases (43 and later) have it, and Alpine carries it in its community repository.

Why is uvx not found when uv works?

uvx is an alias for uv tool run, not a separate package, and the standalone installer puts it next to uv. Look for it in the folder that command -v uv prints, use uv tool run in the meantime, or reinstall with the standalone installer, which installs both.

Related articles

All troubleshooting