When I click on a picture in Google Earth to view it in full-screen, it shows me this error message:

Could not launch any web browser. Please make sure you have set the $BROWSER environment variable to the filename of the web browser we should launch!

What is the best way to set this environment variable globally for all users?


From the Ubuntu Community Documentation on environment variables:

System-wide environment variables

Environment variable settings that affect the system as a whole (rather then just a particular user) should not be placed in any of the many system-level scripts that get executed when the system or the desktop session are loaded, but into

  • /etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings.

Not recommended:

  • /etc/profile - This file gets executed whenever a bash login shell is entered (e.g. when logging in from the console or over ssh), as well as by the DisplayManager when the desktop session loads. This is probably the file you will get referred to when asking veteran UNIX system administrators about environment variables. In Ubuntu, however, this file does little more then invoke the /etc/bash.bashrc file.
  • /etc/bash.bashrc - This is the system-wide version of the ~/.bashrc file. Ubuntu is configured by default to execute this file whenever a user enters a shell or the desktop environment.

The two files under Not recommended will work, but /etc/environment is there just for this purpose so we'll edit that file:

gksu gedit /etc/environment

And add the following line:


enter image description here

You can replace /usr/bin/firefox with the path to whatever browser you prefer.
NOTE: You will have to restart your computer for the changes to take effect.

  • Thanks for the answer. I tried it and it seems to work only if I start google-earth from the terminal. I'm guessing that /etc/bash.bashrc is executed only when bash is started.
    – sashoalm
    Feb 22 '11 at 19:34
  • @satuon Did you try using /etc/environment as shown is my updated answer?
    – Isaiah
    Feb 22 '11 at 20:34
  • I didn't get notification about your update, will try it now.
    – sashoalm
    Feb 26 '11 at 7:49

If your modern Ubuntu version reads ~/.profile, this might be a far more practical place to define the $BROWSER variable on a per-user basis.

Simply add:

export BROWSER=/usr/bin/palemoon
  • What, if anything, reads ~/.personal?
    – muru
    May 30 '17 at 8:24
  • @muru ~/.profile does. May 30 '17 at 8:49
  • Not the default one (here's the default .profile).
    – muru
    May 30 '17 at 8:54
  • 1
    Worse yet, in modern Ubuntu versions, depending on how you login, .profile might not be read at all (GDM doesn't read it, for example, but LightDM does - or used to, anyway).
    – muru
    May 30 '17 at 8:55
  • @muru Interesting. Indeed, I use LightDM on Xubuntu LTS. I will edit my answer accordingly. May 30 '17 at 10:24

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.