Fish Shell: "error: Unable to open universal variable file '/': Permission denied"

Viewed 2929

I am using the Fish shell (version 3.3.1) on MacOS. Every time I run a command it shows this error multiple times:

error: Unable to open universal variable file '/': Permission denied

The commands still run perfectly, but it's very annoying to see these errors. They are still on the screen even after a clear command.

2 Answers

Fish has a feature where it'll store so called "universal" variables to a file on disk, so they can easily be persisted and shared among open fishes.

This error:

error: Unable to open universal variable file '/': Permission denied

Shows that fish is trying to open the file at "/", the root of the filesystem. This points to a misconfiguration, because "/" isn't a file, by definition. It's a directory.

The file is supposed to be in the config directory, which is at:

  • $XDG_CONFIG_HOME/fish, if that variable is set
  • $HOME/.config/fish, if it isn't

I can't find the specific sequence to reproduce this, but it appears that $XDG_CONFIG_HOME or $HOME are set when fish is started (by its parent process, probably the terminal), and to non-functional values.

Was having this same issue after installing using brew install fish.

What finally worked was uninstalling fish.

brew uninstall fish

Then removing fish from my .config folder.

cd ~
rm -rf .config/fish

Then I just installed fish using the fish GUI installer.

Related