path
Inspect PATH entries -- where each directory came from, what executables it contains, and what's shadowing what.
How it works
path reads the current PATH environment variable and traces each directory back to its source file (/etc/paths, /etc/paths.d/*, shell RC files, or eval patterns like brew shellenv). It shows executable counts per directory, flags ghost (nonexistent) directories, and identifies writable entries.
In list mode, every executable is classified as a script or binary. Binaries are identified by language (Swift, Go, Rust, C, Objective-C) by reading Mach-O headers directly. Scripts are identified by shebang. Symlink targets are resolved and displayed.
Shadows mode finds executables with the same name across multiple PATH directories -- the earlier entry wins, and later duplicates are flagged.
Install
Or build from source (requires Xcode and macOS 14+):
Usage
USAGE: path [--list] [--shadows] [--dir ]
OPTIONS:
-l, --list List executables in each directory
-s, --shadows Show only shadowed executables (implies --list)
--dir Filter to a specific directory
--version Show the version
-h, --help Show help information
Examples
path --list # List every executable with type and language classification
path --shadows # Find shadowed executables across PATH directories
path --dir /usr/local/bin # Inspect a single directory
License
MIT