Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
For a way to set user-specific environment variables, see How do I add environment variables? –  Lekensteyn Aug 27 '11 at 8:06

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
    
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? –  Alvin Row 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
    
Thanks, it worked now –  sashoalm Feb 26 '11 at 8:12

Your Answer

 
discard

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.