a simple interactive & one-shot tool to debug path list environment variables
pathdebug {EnvironmentVariableName}
- detect duplicate expanded path entries
- detecting non-existent paths and files
- best effort of finding out where the path is set
- known startup script locations, such as
.bashrc
/etc/path.d
path lists- recursive follow-ups of
source $file
-like statements in the above scripts
- known startup script locations, such as
- interactive mode
- noninteractive formatted output
brew tap d-led/d-led
brew install pathdebug
choco install pathdebug
see package at Chocolatey
go install
from github:
go install github.com/d-led/pathdebug@latest
Alternatively, download the binary from Github releases.
On OSX you might need to run sudo xattr -d com.apple.quarantine pathdebug
on the downloaded binary.
OSX:
curl -s -L https://github.com/d-led/pathdebug/releases/latest/download/pathdebug_Darwin_all.tar.gz | tar xvz - pathdebug
Linux: same procedure, but substitute the artifact name with the appropriate one.
help:
pathdebug --help
export SOME_PATH='/sbin:~/.bashrc:/a:/b:/a:/c:/d:/e:/f:/g'
pathdebug SOME_PATH
↓
tap Esc/q/Ctrl-C to quit, <-/-> to paginate
+---+--------+-----+-----------+
| # | DUP[#] | BAD | PATH |
+---+--------+-----+-----------+
| 1 | | | /sbin |
| 2 | | F | ~/.bashrc |
| 3 | 5 | X | /a |
| 4 | | X | /b |
| 5 | 3 | X | /a |
| 6 | | X | /c |
+---+--------+-----+-----------+
•○
and for the path variable with source detection:
+---+--------+-----+----------------------------------+-----------------+
| # | DUP[#] | BAD | PATH | ±SOURCES |
+---+--------+-----+----------------------------------+-----------------+
| 1 | | | /Users/d/.opam/default/bin | |
| 2 | | | /Users/d/.local/share/ponyup/bin | ~/.zshrc |
| 3 | | | /usr/local/sbin | ~/.zshrc |
| 4 | | | /opt/homebrew/bin | ~/.bash_profile |
| 5 | | | /opt/homebrew/sbin | |
+---+--------+-----+----------------------------------+-----------------+
•○○○○○
pathdebug PATH -o table
see help for other formats
- finding the sources where the
PATH
variable entries are set is best-effort, and is done only for thePATH
environment variable at present - path set by executables currently not tracked as sources
- CSV output may lag in output completeness