Ubuntu – Google Earth and $BROWSER environment variable

environment-variablesgoogle earth

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?

Best Answer

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:

BROWSER=/usr/bin/firefox

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.

Related Question