Debian – Make firefox command run downloaded firefox instead of iceweasel

debianiceweaselsymlink

I have downloaded Firefox, but when I run firefox in Alt+F2 (Gnome 3.4.2), Iceweasel runs instead. I used the type command to find the file apparently responsible for this:

#!/bin/sh

FIREFOX="$(which $0)"
[ -x "$FIREFOX.real" ] && exec "$FIREFOX.real" "$@"

exec iceweasel "$@"

An easy solution is to replace the last line with:

exec [location of downloaded firefox] "$@"

Is there another way to make it so that firefox runs my downloaded copy of firefox instead of iceweasel?

Best Answer

For all users on your machine: writing to /usr/bin

The script itself suggests a method for providing an alternative to iceweasel. I presume that the script is called /usr/bin/firefox. Thus, the line

FIREFOX="$(which $0)"

would set FIREFOX to /usr/bin/firefox. Thus, $FIREFOX.real would be /usr/bin/firefox.real. The line

[ -x "$FIREFOX.real" ] && exec "$FIREFOX.real" "$@"

looks to see if an executable with a .real suffix exists and runs that. If it doesn't find it, it falls back to iceweasel. Thus, to bypass iceweasel you need to create firefox.real:

sudo ln -sT "$location_to_firefox" /usr/bin/firefox.real

Note that root privileges are required to write to /usr/bin.

Just for yourself: writing to ~/bin

If you downloaded firefox into your home directory somewhere, use this method. Debian is set up by default so that if you have a bin directory in your $HOME directory, it will prepend it to your path. Thus all you have to do is:

mkdir -p ~/bin && ln -sT "$location_to_firefox" ~/bin/firefox

Once that symlink is in place it will override /usr/bin/firefox. Log out and back in for the changes to take effect. To confirm, run command -v firefox and make sure it prints the path to the firefox in your ~/bin directory.

Related Question