Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I set a manually downloaded Firefox as my default web browser so that clicking a link in another application will open the link in this Firefox?

I tried these commands, but they didn't seem to work:

update-alternatives --install /usr/bin/x-www-browser x-www-browser /home/user/firefox/firefox 100
update-alternatives --set x-www-browser /home/user/firefox/firefox

What do I have to do?

share|improve this question
up vote 1 down vote accepted

update-alternatives changes the application to use to open a web browser, not the application to use to open a web page. The two are not directly related: “I want to browse the web” is different from “I want to browse this web page”, and there are different kinds of content that happen to all open in a web browser.

What you need to change is which application is associated with the MIME type text/html, and perhaps others. These are configured through the /etc/mailcap file.

On Debian, /etc/mailcap is automatically generated from the applications you have installed. When multiple applications can open the same type, there is a priority system (similar, but distinct, from the priority system for alternatives). You can override these priorities by adding entries to /etc/mailcap.order. For example, the following line will cause Firefox to be used in preference of any other application for all the types it supports:


After you've changed /etc/mailcap.order, run /usr/sbin/update-mime as root to update /etc/mailcap.

If you want to use a program that doesn't come from a Debian package, edit it directly into /etc/mailcap, in the User Section.

# ----- User Section Begins ----- #
text/html; /home/user/firefox/firefox '%s'; description=HTML Text; test=test -n "$DISPLAY";  nametemplate=%s.html
# -----  User Section Ends  ----- #

If you want to set preferences for your own account, define them in ~/.mailcap: the entries in that file override the ones in /etc/mailcap. You have to put full mailcap lines there, such as

text/html; /home/user/firefox/firefox '%s'; description=HTML Text; test=test -n "$DISPLAY";  nametemplate=%s.html
share|improve this answer
i do this but again don't work. for example in x-chat when i click on link nothing happen. – chalist Sep 1 '12 at 22:10

Run both of the commands as root (you should have received a "Permission denied" error when trying to do this without root privileges). Now if you run (or another application runs) x-www-browser, /home/user/firefox/firefox should be the one that gets used.

You can also use the convenient interactive mode update-alternatives --config <name> to set default applications instead of using --set.

share|improve this answer
i do this with root access but don't work – chalist Aug 27 '12 at 20:28
@chalist: Do you receive an error message? What is the output of update-alternatives --display x-www-browser? – Anju Fabulina Aug 27 '12 at 21:38
x-www-browser - manual mode link currently points to /home/user/firefox/firefox /home/user/firefox/firefox - priority 100 /usr/bin/chromium - priority 40 Current 'best' version is '/home/user/firefox/firefox'. – chalist Aug 28 '12 at 0:22
How do you see that it's not working? Which browser gets chosen when you start x-www-browser yourself? – Anju Fabulina Aug 28 '12 at 18:28
when i click a link in application look like choqok i will open in firefox(extracted in home) – chalist Aug 29 '12 at 12:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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