Skip to content

False positive "be sure to add .local/bin to your PATH" warning with relative install root #16023

@SludgePhD

Description

@SludgePhD

Problem

When using a relative path as the install root, Cargo seems to think that the location of the binaries it installs is not contained in $PATH, even if it is.

Steps

~/.cargo/config.toml contains:

[install]
root = ".local"

Then, any cargo install that uses that config will output a warning:

warning: be sure to add `.local/bin` to your PATH to be able to run the installed binaries

My $PATH is set to /home/user/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin.

The binaries do end up in the right place (~/.local/bin) and documentation suggests relative paths are supported, so this seems like a bug.

Possible Solution(s)

Fully canonicalize the path to an absolute one before checking if it's in $PATH.

Notes

No response

Version

cargo 1.90.0 (840b83a10 2025-07-30)
release: 1.90.0
commit-hash: 840b83a10fb0e039a83f4d70ad032892c287570a
commit-date: 2025-07-30
host: aarch64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.14.1-DEV (sys:0.4.82+curl-8.14.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Fedora 42.0.0 (adams) [64-bit]

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bugCommand-installS-triageStatus: This issue is waiting on initial triage.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions