5

In Debian 10 there is this command to choose the default browser:

 update-alternatives --config x-www-browser

I installed Waterfox from a .deb file and it is not showing up in the list of available browsers. Is there a way to add it?

0

1 Answer 1

11

Your setup is probably similar to mine, I have two entries in the link group x-www-browser for Firefox and Google Chrome. Let's take this as example:

$ update-alternatives --display x-www-browser
x-www-browser - auto mode
  link best version is /usr/bin/google-chrome-stable
  link currently points to /usr/bin/google-chrome-stable
  link x-www-browser is /usr/bin/x-www-browser
  slave x-www-browser.1.gz is /usr/share/man/man1/x-www-browser.1.gz
/usr/bin/firefox-esr - priority 70
  slave x-www-browser.1.gz: /usr/share/man/man1/firefox-esr.1.gz
/usr/bin/google-chrome-stable - priority 200

There are two symbolic links setup pointing to the selected entry:

$ ls -l /usr/bin/x-www-browser
lrwxrwxrwx 1 root root 31 Sep 16  2018 /usr/bin/x-www-browser -> /etc/alternatives/x-www-browser
$ ls -l /etc/alternatives/x-www-browser 
lrwxrwxrwx 1 root root 29 May  4 20:45 /etc/alternatives/x-www-browser -> /usr/bin/google-chrome-stable

And the interactive menu shows Google Chrome as auto-selected (highest priority):

$ update-alternatives --config x-www-browser
There are 2 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                           Priority   Status
------------------------------------------------------------
* 0            /usr/bin/google-chrome-stable   200       auto mode
  1            /usr/bin/firefox-esr            70        manual mode
  2            /usr/bin/google-chrome-stable   200       manual mode

Press <enter> to keep the current choice[*], or type selection number:

Add an entry

To add an entry, you need the --install command, the link, the link name, the path to the program and priority.

Change the path to Waterfox and priority as needed:

sudo update-alternatives \
  --install /usr/bin/x-www-browser x-www-browser /usr/local/bin/waterfox 210

Result:

$ update-alternatives --config x-www-browser
There are 3 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                           Priority   Status
------------------------------------------------------------
* 0            /usr/local/bin/waterfox         210       auto mode
  1            /usr/bin/firefox-esr            70        manual mode
  2            /usr/bin/google-chrome-stable   200       manual mode
  3            /usr/local/bin/waterfox         210       manual mode

Press <enter> to keep the current choice[*], or type selection number:

You can setup optional slave links as shown for Firefox above. If Firefox is selected, an additional link x-www-browser.1.gz pointing to the man page /usr/share/man/man1/firefox-esr.1.gz is setup.

The syntax for --slave is the same as for --install, but without priority, e.g.:

sudo update-alternatives \
  --install /usr/bin/x-www-browser x-www-browser /usr/local/bin/waterfox 210 \
  --slave /usr/share/man/man1/x-www-browser.1.gz x-www-browser.1.gz /usr/local/share/man/man1/waterfox.1.gz

Remove an entry

To remove Waterfox again, you need the link name and path:

sudo update-alternatives --remove x-www-browser /usr/local/bin/waterfox
2
  • Excellent explanation, thank you!
    – raphael75
    May 5, 2020 at 13:22
  • update-alternatives: error: alternative link /usr/bin/x-www-browser is already managed by x-www-browser
    – Jiang YD
    Jan 28 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.