Fish shell: Customize $PATH
nabbisen
Posted on May 12, 2021
Summary
This post shows how to customize $PATH
, an environment variable, in Fish shell.
How-to
Here shows how to add to $PATH
, for example.
1. Set Temporarily
All what to do is run this command:
$ set -x PATH <some-path> $PATH
Well, set
's -x
(or --export
) means it "causes the specified shell variable to be exported to child processes (making it an "environment variable")".
2. Set Permanently
2-1. config.fish
Fish shell has $HOME/.config/fish/config.fish
as .profile
to other shells. Append this line to the bottom of it:
...
+ set PATH <some-path> $PATH
2-2. fish_user_paths
There is another and more "fisher" way. Use its fish_user_paths
, a universal variable of Fish shell.
Open your terminal and run this command:
$ set -U fish_user_paths <some-path> $fish_user_paths
-U
(or --universal
) means it "causes the specified shell variable to be given a universal scope".
Be careful not to write it in config.fish
, which is called every time Fish shell starts.
Posted on May 12, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.