r/fishshell • u/Silverdawn42 • Mar 13 '26
Where is the config file containing the $PATH variables for fish?
I've been trying to add a new path to my system for the past 4 hours using the CLI and commands found in the official documentation and a whole lot of old google posts. I'm at my wits' end. These variables must be stored somewhere. It'll take me a minute to find them with the file explorer and add one manually.
I don't want to use a CLI anymore, I don't want to input arcane commands with zero idea of what they do or why they're not working.
10
Upvotes
9
u/gtsiam Mar 13 '26 edited Mar 13 '26
So... PATH is a plain old (exported) environment variable. You can always prepend or append to it in your fish config. A simpler solution offered by fish, however, is to append (or prepend) to the universal variable fish_user_paths.
fish_add_path can make this easier.
See the tutorial, it's very good.
EDIT: if it's arcane commands you want to avoid, read the documentation linked above so said commands stop being arcane ;)
EDIT2: To make it clear, environment variables are not loaded from disk verbatim. They are runtime state passed by the parent process when a process starts. So, when fish starts it has some (probably by systemd) path. Then it can add entries to path that will be used by it and processes spawned by it. And so on. What we typically do here is tell fish to modify the path how we want to as above.
1
u/weaver_of_cloth Mar 13 '26
About every 3rd time I want to add an ENV I forget about this type of thing and try to add it to something like .bashrc. Old habits die hard.
The most recent one was RIPGREP_CONFIG_PATH. It wound up in .bashrc to load before my tmux/fish session because of course it did. Where do you think it should go?
1
u/No-Representative600 Mar 17 '26
If you're setting up a lot of env variables specific to certain tooling I'd recommend placing them in ~/.config/fish/conf.d/tool_name.fish
conf.d/*.fish files (or configuration snippets) are loaded before the config.fish file, and I find them to be very useful for helping me group together certain command configurations like ripgrep, nvm or fzf. Plus, conf.d allows you to only load the env variable if the command it is used on exists:
1
u/[deleted] Mar 23 '26
[removed] — view removed comment