The Cellar  

Go Back   The Cellar > Main > Technology
FAQ Community Calendar Today's Posts Search

Technology Computing, programming, science, electronics, telecommunications, etc.

Reply
 
Thread Tools Display Modes
Old 05-26-2004, 05:30 PM   #1
hot_pastrami
I am meaty
 
Join Date: Dec 2001
Location: Salt Lake City, UT
Posts: 1,119
Mac OSX question

Hey guys,

Does anybody happen to know how to set an environment variable in Mac OSX? It needs to be available for any program launched through the GUI. About the most helpful info I can find on the subject, both on the Internet and in OSX Help, is "clap one hand as a tree falls in the forest." Cosmic.

Anybody?
__________________
Hot Pastrami!
hot_pastrami is offline   Reply With Quote
Old 05-27-2004, 11:51 AM   #2
Pie
Gone and done
 
Join Date: Sep 2001
Posts: 4,808
Re: Mac OSX question

Quote:
Originally posted by hot_pastrami
Does anybody happen to know how to set an environment variable in Mac OSX? It needs to be available for any program launched through the GUI.
I don't know about GUI availability, but setting variables happens thusly in a csh/tcsh (& bash?) environment:

setenv VARIABLENAME variablevalue

eg, "setenv COLORTERM linux"

You can find out more by typing "man setenv" at a command prompt.

If you add this declaration to your .tcshrc or .cshrc file, this variable will be set for you every time you log in.


HTH,
- Pie
__________________
per·son \ˈpər-sən\ (noun) - an ephemeral collection of small, irrational decisions
The fun thing about evolution (and science in general) is that it happens whether you believe in it or not.
Pie is offline   Reply With Quote
Old 05-27-2004, 12:31 PM   #3
Pie
Gone and done
 
Join Date: Sep 2001
Posts: 4,808
Aha! I think I found exactly what you're looking for:

http://developer.apple.com/qa/qa2001/qa1067.html

Q: How do I set environment for all processes launched by a specific user?

A: It is actually fairly simple process to set environment variables for processes launched by a specific user.

There is a special environment file which loginwindow searches for each time a user logs in. The environment file is: ~/.MacOSX/environment.plist (be careful it's case sensitive). Where '~' is the home directory of the user we are interested in. You will have to create the .MacOSX directory yourself using terminal (by typing mkdir .MacOSX). You will also have to create the environment file yourself. The environment file is actually in XML/plist format (make sure to add the .plist extension to the end of the filename or this won't work). An example environment file is shown below. The file was created using /Developer/Applications/PropertyListEditor.app

[see below]

Here the environment variables TestEnvironmentVariable and MrX are set to /My/Value and 1 respectively, every time that specific user logs in. You can add more environment variables by adding new siblings to the property list using the 'New Siblings' button shown above.

Note that the key class must be string. If any other class is used the key will not be recognized by loginwindow. You can confirm the environment variables have been set as expected by typing setenv into terminal.
Attached Images
 
__________________
per·son \ˈpər-sən\ (noun) - an ephemeral collection of small, irrational decisions
The fun thing about evolution (and science in general) is that it happens whether you believe in it or not.
Pie is offline   Reply With Quote
Old 05-27-2004, 01:20 PM   #4
Beestie
-◊|≡·∙■·∙≡|◊-
 
Join Date: Feb 2003
Location: Parts unknown.
Posts: 4,081
The konfabulator may or may not do the job but its pretty interesting.
__________________
Beestie is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 10:22 AM.


Powered by: vBulletin Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.