-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 8-Jan-07, at 6:14 PM, Dave Land wrote:
On Jan 8, 2007, at 3:03 PM, Dave Land wrote:
Happily, Apple provided a utility that handles it for you:
defaults read "${HOME}/.MacOSX/environment"
Actually, making this work in bash (or other shell) requires a
little more than just reading the file... Here's the relevant chunk
from my .bashrc:
# Get environment variables from ~/.MacOSX/environment.plist
# (This avoids the sin of duplicating data here and in that file)
if [[ `uname` == 'Darwin' ]] ; then
defaults read ~/.MacOSX/environment | grep -v '[{}]' | tr '"'
"'" | awk '{ print "declare -x",$1"="$3 }' | while read -r OneLine;
do eval $OneLine; done;
fi
To give credit where it's due, this came from a comment on
macosxhints.com.
The conditional (if [[ `uname` == "Darwin' ]]) is because I use
this same .bashrc across several hosts, including Solaris, Linux,
and Mac OS X.
Just a quick note to anyone using that plist option - I once wasted
about 20 hours of my time because a 'bad? corrupt? I never determined
exactly'
enviroment.plist file caused my home folder to become read-only to
the Finder! IIRC Terminal.app could still manipulate files.
It caused all sorts of nifty issues (mainly because ~/Library is used
so much). Since it's a single user machine, it looked like some
bizarre disk issue.
What really got me going was when I couldn't find the problem, I
reinstalled from scratch, everything was fine, then it came back when
I restored my home folder.
Much hair tearing occurred on that one!
Hopefully I can save a few follicles for somebody else.
Brian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)
Comment: Verify this email or encrypt your email for free - see gnupg.org
iD8DBQFFo+f8GnOmb9xIQHQRAsbaAJ9GcS7DyjSU78O1v3YWxdgtoBReUgCgy8Aq
HHLv34cFN6eyzje31pYIysk=
=c/F5
-----END PGP SIGNATURE-----