Enironment Variables

Christoph_1982

Registered
Hello,

i want to set set environment variables which are accessable for the hole system and not only for one user logged in. For now i made an folder .macosx and defined my variable with the file environment.plist. The problem is: that musst be done for every user.

What is the way to define that variable for the system so that every user can access that variable?

Is it possible to handle it with an executeable file?
 
/Users/Shared.

All users will be able to access it. Unix is about permissions. That is the security people are talking about. Anything put in Applications will be seen by every User.

The Apple(Unix) folder system is based on levels. Main Level is Applications and the first set of folders. This is mainly for system files so the computer will run. The Users folder is where individual users folders are kept so you the user can save files without jeopardizing the Main System files.

Apple talks about permissions.
 
In folder /users/shared i added an folder .macosx and the file environment.plist.

I logged on with an Domain User but he haven't access to that environment variable. In the terminal i looked it up with the command "set". The environment variable wasn't in the listing.
 
Well there are several help programs.

Sharity is one i think of off the top of my head. Also make sure you do (as an Administrator) Get Info on the file to make sure all users have permissions to the folder and parent folders.
 
That won't work, unfortunately. Sure, all users will be able to access it, but the system won't read the environment.plist file from there and use it.

If you are only wanting these variables for the terminal or console, and not GUI apps, then you can add the variables to /etc/bashrc. That is read by every term session when it's setting up the shell. (Note, that's for bash/sh. If you're using csh/tcsh, you'd use /etc/cshrc.)
 
FWIW, here is the console output showing the results of my failed experiment to partially implement this feature.

What I tried to do was use standard XML include syntyax to pull an XML fragment that could be shared among those individual user environment.plist files that referenced it.

As I said, it didn't work. Worse, it broke the plist that was there.

I invite all comments or suggestions.

In the listing that follows the prompt has been rendered as ">>>>" and parts of the output have been replaced with [...] for readability.


>>>> pwd

/Users/rneyman/.MacOSX

>>>> cat environment.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd" [
<!ENTITY sharedPlist SYSTEM "/Users/Shared/.MacOSX/shared.plist.fragment">
]>
<plist version="1.0">
<dict>
&sharedPlist;
<key>DISPLAY</key>
<string>:0.0</string>
<key>VDE_DEV_PATH</key>
<string>/Users/rneyman/[...]/VideoDisplayEngine</string>
<key>VDSJNI_DEV_PATH</key>
<string>/Users/rneyman/[...]/VideoDisplayServiceJNI</string>
</dict>
</plist>

>>>> cat /Users/Shared/.MacOSX/shared.plist.fragment

<key>TESTSHAREDPLIST</key>
<string>Whatifaboofida</string>
<key>JAVA_HOME</key>
<string>/System/[...]/CurrentJDK</string>
>>>> ECHO $TESTSHAREDPLIST

>>>> ECHO $DISPLAY

>>>>
 
Back
Top