Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.92 KB

File metadata and controls

55 lines (37 loc) · 1.92 KB

path

Swift 6.0 macOS 14+ License: MIT

Inspect PATH entries — where each directory came from, what executables it contains, and what's shadowing what.

path

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

brew install ansilithic/tap/path

Or build from source (requires Xcode and macOS 14+):

make build && make install

Usage

USAGE: path [--list] [--shadows] [--dir <path>]

OPTIONS:
  -l, --list              List executables in each directory
  -s, --shadows           Show only shadowed executables (implies --list)
  --dir <path>            Filter to a specific directory
  --version               Show the version
  -h, --help              Show help information

Examples

path                     # Show all PATH entries with sources and executable counts
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