Re: role of ~/.MacOSX/environment.plist ?
Re: role of ~/.MacOSX/environment.plist ?
- Subject: Re: role of ~/.MacOSX/environment.plist ?
- From: Mike Zuhl <email@hidden>
- Date: Sat, 31 Mar 2007 15:52:36 -0700
On Mar 30, 2007, at 1:01 PM, fred lakin wrote:
Hmmm ... the only file in my "~/.MacOSX/" dir is environment.plist-
dont,
which renaming apparently I did back on 4 Mar 2004 . Still has what I
assume are virgin default values, see below.
So, what problems might I be having? Everything seems to work
fine except that iTunes freezes up X11 from time to time ...
[well, OK, also my back hurts and the roof leaks, but if that's
related, OS X is a lot more formidable than I thought ...]
Who and When
============
Child processes inherit environment variables from their parent (as
sort of a hidden argument list) rather than being truly "global." A
process can make changes to environment variables that are in turn
inherited by their children. That's why changing an environment
variable in, e.g., a shell won't affect anything other than the child
processes of that shell.
This means that in order to set the environment variables for all
apps that are started by the Finder, you have to load up the
environment variables in the Finder or some process ancestor of the
Finder. When Aqua starts, ~/.MacOSX/environment.plist (if it exists)
is slurped up and us used to populate the environment variables.
That's why you have to logout and log in again for the change to take
affect (as pointed out by Doug McNutt).
What and Why
============
By default, processes get a set of environment values that will get
you by; however, most customization (e.g, loading programs via
"fink") requires changes to the environment. Some variables are:
DISPLAY
As a X11 user you should be familiar with this, the path to the X-
server. It is set by xinit (I think) so all the process's children
(especially the window manager) know how to get to the user. If you
launch an app from someplace else (e.g., the Finder) it won't know
how to find the X-server. The format of this value is
"<host>:<display-number>.0". (I don't remember what the trailing ".
0" is supposed to do. When I last looked at the X-server source 10
or so years ago it was simply ignored.) The "<host>" part defaults
to "localhost." There is no default for the display number, but it's
usually "0" if local. The X-client app connects to TCP socket
<display-number>+6000 on <host> to talk to its server. (BTW, to
tunnel thru ssh the ssh client sets $DISPLAY to be a port local to
the client with a non-zero display number in order to intercept the X-
lib traffic.)
PATH
Perhaps the most important variable, this is the list of directory
paths to search to find commands. As with other path lists, each
element is separated by a colon (":").
LD_LIBRARY_PATH
Often gets changed with customization, this is the path to search for
shared libraries at run time. Frankly I'm not sure how this
interacts with OSX library search mechanism, but if your X11 app uses
special libraries, chances are they are in this path.
SHELL
The path the the user's preferred shell. Do you use a non-standard
shell (e.g. tcsh) and are annoyed to find that commands seem to use
bash instead of your favorite for shell-like operations? Chances are
$SHELL is not set up correctly.
Some more esoteric environment variables:
LC_ALL
Controls localization of string comparison libraries. I always set
this to "C" to force plain-old-ascii comparisons. I can't tell you
how many mysterious bugs this has made disappear, but then I'm in the
USA and I18N just confuses me :-).
PERL5LIB
Path to look for perl modules.
PYTHONPATH
Path to look for python modules.
INFOPATH
Where to search for "info" pages (favorite documentation format of
GNU folks).
MANPATH
Where to search for manual pages.
CVSROOT
Path to default CVS repository.
This is not a complete list. You can use the "env" command from any
shell to list the current environment variables for that shell. For
instance, if you have loaded the fink package you will notice a
number of "/sw/..." paths in the variables. This is all fink-
specific stuff.
Most of these variables have perfectly reasonable default values.
It's just that if you have any customization, you may need to change
them. Most X11 app have been ported from a vanilla Unix/Linux system
and rely more heavily on environment variables than, say, built-for-
Mac apps that use OSX mechanisms. So you, as an X11 user, have a
much higher chance of running into an environment variable issue than
other Mac users.
Troubleshooting
===============
Finally, to address Fred's question! Answer: if you don't have any
troubles, don't worry about this.
[RE: Back problems: try adjusting your work area. RE: Roof.... I'll
get back to you.]
If you are having troubles, try setting up ~/.MacOSX/
environment.plist, logging out and logging back in again and see if
it solves your problem. If it does, great! If it doesn't, then no
harm done--only by setting key environment variables to absurd values
can you cause problems. That's why I wrote SetMacEnv to use its
current environment: the values are probably not absurd (or you
couldn't run the shell) and they probably include everything you
need, including stuff set up by the fink installation.
I hope this helps!
--MAZ
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list (email@hidden)
This email sent to email@hidden