If you're like me, you might have a number of export PATH
statements
littering your shell resource file (e.g., .zshrc
, .bashrc
, etc). Over time,
many directory entries get added and revised. Those that remain eventually
become unnecessary, are mistakenly duplicated, or represent directories that no
longer exist on the system. This is my attempt at cleaning up PATH
environment variable. Hopefully, others will find this to be useful.
- Clone repo
- Change to repo directory (Assuming repo was downloaded to ~/Downloads/pathos.rb on MacOS)
cd ~/Downloads/pathos.rb
- Run it
ruby pathos.rb
Each time you save your changes to the directory list, pathos.rb
will build a
revised export $PATH
statement that is written to $HOME/.pathos.env
.
To use the new PATH, $HOME/.pathos.env
MUST BE SOURCED to take effect
within your shell.
source $HOME/.pathos.env
Key | Description |
---|---|
↑/k | up |
↓/j | down |
o | add path (below current selected path) [1] |
O | add path (above current selected path) [1] |
x | remove current path |
X | remove non-existent paths |
D | remove duplicate paths |
S | save |
q | quit |
Color | Description |
---|---|
Yellow | Shows current selected path |
Red | Indicates paths that do not exist |
Aqua | Indicates duplicate paths |