Go Back   The macosxhints Forums > OS X Help Requests > UNIX - X11



Reply
 
Thread Tools Rate Thread Display Modes
Old 06-04-2003, 04:28 PM   #1
Guybrush
Triple-A Player
 
Join Date: May 2003
Location: homeless
Posts: 111
$PATH environment in X11

If i start X11 from my dock it doesnt have the $PATH i specified in my .cshrc (which is logical), ive also tried adding the following to my .xinitrc but doesnt work either:
PATH=$PATH:/sw/bin:/sw/sbin
export PATH

creating a environment.plist in ~/.MacOSX didnt help either, it even breaks X11 somehow when i use the enviroment.plist, it will skip your ~/xinitrc and use the default..

Has anyone else encountered this problem?
Guybrush is offline   Reply With Quote
Old 06-04-2003, 07:04 PM   #2
Guybrush
Triple-A Player
 
Join Date: May 2003
Location: homeless
Posts: 111
never mind, i just fixed my problem by changing my X11 application items to:

XMMS - export PATH=$PATH:/sw/bin:/sw/sbin;xmms

this also fixes the esd problem..
Guybrush is offline   Reply With Quote
Old 06-04-2003, 08:27 PM   #3
yellow
Moderator
 
Join Date: Jan 2002
Posts: 10,677
Personally, I set my path in my .login.
yellow is offline   Reply With Quote
Old 06-05-2003, 11:28 AM   #4
Guybrush
Triple-A Player
 
Join Date: May 2003
Location: homeless
Posts: 111
that doesnt seem to get executed when you start X11 from the dock.
Guybrush is offline   Reply With Quote
Old 06-05-2003, 11:51 AM   #5
yellow
Moderator
 
Join Date: Jan 2002
Posts: 10,677
You're right it doesn't.. what's up with that?! You could put:
Code:
source .login
in your .tcshrc.. and set your path in your .login. That works.
yellow is offline   Reply With Quote
Old 06-05-2003, 12:01 PM   #6
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
it works for some cases. subshells would get redundant instances of elements in PATH if one uses yellow's method.

it's better to test if you're an X11 term and not a subshell in .xxxrc and if so, then do the path mangling that is done in .login

if [ $SHLVL = 2 ]; then echo foo; fi

if [ $TERM = 'xterm' ]; then echo foo; fi


or something like that. one must understand those two conditions above in an xterm window.
__________________
On a clear disk, you can seek forever.
mervTormel is offline   Reply With Quote
Old 06-05-2003, 12:17 PM   #7
Guybrush
Triple-A Player
 
Join Date: May 2003
Location: homeless
Posts: 111
Quote:
Originally posted by yellow
You're right it doesn't.. what's up with that?! You could put:
Code:
source .login
in your .tcshrc.. and set your path in your .login. That works.

wont that be the same if you put your path in .tcshrc?
since .tcshrc just calls .login then.. But wont work either since X11 doesnt call .cshrc

anyway, i just fixed it to add the path in every X11 item i have. kinda overkill but it works as it should.
I dont know which file X11 initializes..
Guybrush is offline   Reply With Quote
Old 06-05-2003, 12:51 PM   #8
sao
Moderator
 
Join Date: Jan 2002
Location: Singapore
Posts: 4,237
Quote:
Guybrush wrote:
creating a environment.plist in ~/.MacOSX didnt help either, it even breaks X11 somehow when i use the enviroment.plist, it will skip your ~/xinitrc and use the default..

Two possible ways to have a complete *global* PATH variable:

1- One could use the ~/.MacOSX/environment.plist, but it will give the same environment variables to *all* applications and that can create problems.

2- A "wrapper script". (Tip from Martin Costabel)

It's an evil hack, but one would hope that this kind of hack will not be necessary for the final version of X11.app:

A. Rename /Applications/X11.app/Contents/MacOS/X11 to /Applications/X11.app/Contents/MacOS/X11.bin

B. Write a shell script named /Applications/X11.app/Contents/MacOS/X11 containing, for example:

Code:
#!/bin/tcsh
source /etc/csh.login
source /etc/csh.cshrc
exec /Applications/X11.app/Contents/MacOS/X11.bin
You can add something there, run 'source /sw/bin/init.csh' or other commands defining the environment. Don't forget to make it executable.

C. If you don't understand any details of the points A. or B., then, don't even try to do this. You are on your own.


If you do this correctly, clicking on the X11 icon will work as before, but X11 will come up with a complete set of environment variables.
sao is offline   Reply With Quote
Old 06-05-2003, 02:08 PM   #9
yellow
Moderator
 
Join Date: Jan 2002
Posts: 10,677
Sweet.. that's *($&@# genius! It works like a charm! Naturally I sub'd my own .tcshrc & .login since I'm the only person who uses this machine. Thanks Sao!
yellow is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 11:31 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.