User Agents

Web browsers and everyday web tech, explained

Set Default Browser on Debian

· 5 min read · Settings and Privacy

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Setting the default browser on Debian ensures that links from email clients, chat apps, and other programs open in the browser you prefer. This guide covers both the GNOME desktop (default on many Debian installs) and other environments, using both graphical tools and the command line. You'll need a user account with sudo privileges for the command-line method, but the graphical method works for any user.

What You'll Need

  • A Debian system with a desktop environment (GNOME, KDE, XFCE, etc.)
  • A web browser installed (e.g., Firefox, Chromium, Google Chrome)
  • For the command-line method: sudo access

Step-by-Step

  1. Identify your desktop environment. The steps differ slightly. If you're using GNOME (the default), look for the Activities overview. For KDE, XFCE, or others, the settings app will be named accordingly.
  2. Open System Settings. In GNOME, click the Activities button (top-left) and type "Settings" or "Settings" in the search bar. In KDE, it's "System Settings"; in XFCE, "Settings Manager".
  3. Find Default Applications. In GNOME, look for "Default Applications" in the left sidebar under "System". In KDE, it's under "Applications". In XFCE, look for "Preferred Applications" in the settings manager.
  4. Select the Web Browser. In the default applications panel, find the "Web" or "Browser" dropdown menu. Click it and choose your preferred browser from the list.
  5. Close the settings window. Your choice is saved automatically.
  6. For command-line method (alternative): Open a terminal and run the following command to set the default browser globally for your user:
    xdg-settings set default-web-browser firefox.desktop
    Replace firefox.desktop with the correct .desktop file name for your browser (e.g., chromium.desktop, google-chrome.desktop). To find the exact name, run ls /usr/share/applications/ | grep -i browser.
  7. Verify the change. Open a terminal and run xdg-settings get default-web-browser. It should output the .desktop file name you set.

Common Mistakes

  • Choosing a browser that isn't installed. The dropdown in settings may show browsers that are not actually installed. Only select one that you know is present.
  • Using the wrong .desktop file name. In the command-line method, the name must match exactly (case-sensitive) and include the .desktop extension. Using firefox instead of firefox.desktop will fail silently.
  • Editing system-wide settings instead of user settings. The graphical method changes settings for your user only. If you need to set it for all users, you must edit /etc/xdg/ files or use sudo with xdg-settings (though this is not recommended).
  • Forgetting that some apps have their own browser settings. For example, the Evolution mail client has its own browser preference. Check the app's own settings if links still open in the wrong browser.

Tips

  • Use the command line for scripts. If you're setting up multiple machines, you can script the xdg-settings command.
  • Know the .desktop names. Common ones: firefox.desktop, chromium.desktop, google-chrome.desktop, microsoft-edge.desktop.
  • Check your environment. On a minimal Debian install without a desktop, the graphical method won't apply. Use xdg-settings in a terminal.
  • After changing, test with a link from a non-browser app. For example, open an email client and click a link to confirm it opens in your chosen browser.

Troubleshooting

Links still open in the old browser. First, verify that the change was applied by running xdg-settings get default-web-browser. If it shows the correct browser, the problem is likely in the app that's opening links. Check that app's settings (e.g., Thunderbird has its own browser selection). If it's a system-wide issue, you may need to update the alternatives system: run sudo update-alternatives --config x-www-browser and select your preferred browser.

The dropdown in settings is grayed out. This can happen if there's no installed browser that provides the necessary MIME type. Install a browser (e.g., sudo apt install firefox-esr) and then try again.

The .desktop file name is not found. Run find /usr/share/applications -name '*.desktop' | grep -i browser to list available browser .desktop files. If your browser is installed in ~/.local/share/applications, you may need to use the full path or the exact name from there.

Changes revert after reboot. This is rare but can happen if another application overwrites the default. Check if you have any startup scripts that run xdg-settings with a different value. Also ensure you're not running multiple desktop environments that override each other's settings.

Frequently Asked Questions

How do I set the default browser from the command line without sudo?

Run xdg-settings set default-web-browser [browser].desktop. This changes the setting for your user only and does not require sudo.

What is the difference between xdg-settings and update-alternatives?

xdg-settings sets the user-level default browser for desktop applications. update-alternatives sets the system-wide default for commands like x-www-browser and www-browser. For most desktop use, xdg-settings is sufficient.

Can I set a different default browser for different users?

Yes, each user has their own settings. Use the graphical method or xdg-settings while logged in as that user.

Why does my browser not appear in the default applications list?

It may not have a .desktop file installed, or it may not be registered with the desktop environment. Reinstall the browser or manually create a .desktop file in ~/.local/share/applications.

How do I set the default browser for a specific application like Thunderbird?

Open the application's preferences. In Thunderbird, go to Preferences > Advanced > General and click "Config Editor". Search for network.protocol-handler.warn-external.http and set it to true to be prompted on first click. Alternatively, in the app's settings, look for "browser" or "open links in" options.

Does setting the default browser affect terminal commands like sensible-browser?

Yes, sensible-browser uses the same xdg-settings mechanism, so it will respect your choice. However, commands that explicitly call a specific browser (e.g., firefox) will still open that browser.