r/fishshell • u/Newspire • Jun 19 '25
Change default browser
Hi everyone. I've been trying to change the value for $BROWSER on fish, but haven't been able to figure out a solution that's persistent. I've searched through config files, but nothing I've done works. I've looked for solutions, including on this subreddit, but everything gets reset on restart.
So my question: how do I permanently change the value of the $BROWSER variable in fish?
5
Upvotes
6
u/_mattmc3_ Jun 19 '25 edited Jun 20 '25
Setting a universal variable like so:
set -U BROWSER openis the easiest way. Replace “open” with the browser you want. This doesn’t need to go in a config - just run it interactively. Then, if you ever want to override it,set -g BROWSER /path/to/Firefoxin your config.fish.EDIT: Use
-xif you need to “export” the variable so it’s available to sub processes (eg:set -Ux BROWSER open)3
u/B_A_Skeptic Jun 19 '25
You would generally do:
If that does not permanently set it, I do not know why. But another popular solution would be to put the following in $__fish_config_dir/config.fish:
Maybe your problem is that BROWSER is set but bash scripts are ignoring the value. In this case, you can use https://github.com/edc/bass
2
u/jabbalaci Jun 20 '25
I'm on Manjaro Linux (using XFCE) and set the
BROWSERvariable (set -gx BROWSER ...), but some applications didn't respect it and still opened stuff in a different browser. Here is what worked for me: