[Xquartz-dev] env variables and launchd problem

Jeremy Huddleston jeremyhu at apple.com
Mon Mar 21 17:11:51 PDT 2011


I think the problem is that you are setting the values in .bashrc.  X11 inherits your *login* shell environment.  This is set by .profile (not .bashrc).  The way I work around this is to add the following to my .profile which causes my .bashrc to be included as well:

if [ "${BASH-no}" != "no" ]; then
	[ -r ${HOME}/.bashrc ] && . ${HOME}/.bashrc
fi




On Mar 21, 2011, at 16:45, Dave Ray wrote:

> I want to ask again because nobody replied to my previous post, and maybe I should provide more info.
> 
> My environment variables do not seem to be passed to X11 apps when starting up XQuartz with launchd. A different set of env variables are there. I am not sure when this problem started, I only just now discovered it. I launched an xterm from ~/.xinitrc.d/whatever.sh and typed 'env'. I could post the actual values but I don't think it's important.
> 
> I can fix the problem by adding the appropriate variables to ~/.MacOSX/environment.plist. But then I have two files to maintain, /etc/bashrc and  ~/.MacOSX/environment.plist. I would prefer not to have to do that, unless that is the expected way.
> 
> According to the XQuartz FAQ (http://xquartz.macosforge.org/trac/wiki/X11-UsersFAQ) XQuartz should inherit my shell environment, and says I should post to this list of it isn't.
> 
> I'm using the latest XQuartz 2.6.1 final on Snow Leopard 10.6.6. I have removed /Applications/Utilities/X11.app (actually, compressed it) and renamed /usr/X11 and /usr/X11R6 to /usr/X11-temp and /usr/X11R6-temp. This is to be absolutely sure there aren't conflicts in the two X11 environments. (Is this bad?)
> 
> The problem happens regardless of what I launch from my ~/.xinitrc.d/whatever.sh.
> 
> The problem does not occur if I start XQuartz without launchd, for example, by typing 'startx' at the terminal.
> 
> I looked over my system and don't think it''s a config issue, but if someone confirms the problem is limited only to my machine, I will look further.
> 
> Could someone chime in and let me know if this is normal or not, my env in /etc/bashrc not being passed to the apps launched from ~/.xinitrc.d/whatever *IF and only IF* they are launched by launchd.
> 
> Thanks.
> 
> 
> 
> _______________________________________________
> Xquartz-dev mailing list
> Xquartz-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/xquartz-dev
> 



More information about the Xquartz-dev mailing list