Skip to main content

uv tool update-shell

Ensure that the tool executable directory is on the PATH.

Aliases

  • uv tool ensurepath - Alternative name for the same command

Usage

Description

If the tool executable directory is not present on the PATH, uv will attempt to add it to the relevant shell configuration files. If the shell configuration files already include a blurb to add the executable directory to the path, but the directory is not present on the PATH, uv will exit with an error. The tool executable directory is determined according to the XDG standard and can be retrieved with uv tool dir --bin.
After running this command, you need to restart your shell or source your shell configuration file for the changes to take effect.

When to Use

Run this command when:
  • You’ve just installed your first tool with uv tool install
  • You get “command not found” errors after installing a tool
  • You’ve installed uv and want to ensure tools can be run from anywhere
  • You’re setting up a new development environment

Examples

Add tool directory to PATH

Expected output:

Apply changes immediately

Check if update is needed

What Gets Modified

The command modifies your shell configuration file by adding the tool directory to your PATH. The specific file depends on your shell:

Bash

Modifies ~/.bashrc (Linux) or ~/.bash_profile (macOS):

Zsh

Modifies ~/.zshrc:

Fish

Modifies ~/.config/fish/config.fish:

PowerShell (Windows)

Modifies PowerShell profile:

Tool Executable Directory

The tool executable directory location varies by platform:

Unix/Linux/macOS

Determined by the following environment variables, in order:
  1. $UV_TOOL_BIN_DIR (if set)
  2. $XDG_BIN_HOME (if set)
  3. $XDG_DATA_HOME/../bin (if XDG_DATA_HOME is set)
  4. $HOME/.local/bin (default)

Windows

  • %LOCALAPPDATA%\uv\bin

Finding your tool directory

Behavior Details

Already configured

If the configuration is already present, uv will report this:

Configuration exists but not in current PATH

If the shell configuration file contains the correct entry but your current PATH doesn’t include it:

Multiple shells

If you use multiple shells, run the command in each:

Verification

After running uv tool update-shell and restarting your shell:

Check PATH includes tool directory

Test with an installed tool

Check shell configuration

Troubleshooting

Changes not taking effect

If tools are still not found after running update-shell:

Permission errors

If you get permission errors when modifying shell configuration:

Multiple PATH entries

If you’ve run update-shell multiple times, you might have duplicate entries:

Custom shell location

If you use a non-standard shell configuration location:

Container/Docker environments

In containerized environments, you might need to add the PATH directly:
Or in your shell:

Tool directory on non-standard location

If using a custom tool directory via UV_TOOL_BIN_DIR:

Best Practices

First-time setup

When setting up uv on a new system:

Team onboarding

Include in your project’s setup documentation:

CI/CD environments

In CI/CD, explicitly set PATH instead of using update-shell:

Manual Configuration

If you prefer to manually configure your PATH or update-shell doesn’t work for your setup:

See Also