Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

login paths, was Re: Still Happening



On Feb 18, 2007, at 3:35 PM, Allan Seidel wrote:

BTW, Just for grins I uncommented the exec wmaker line I had in my home .xinitrc from when I tried it while back (and decided not to use it along with all the other wms installed using Fink) and it was not found. I had to put a /sw/bin/ in front of it. That path is not known anymore to this machine's X11, yet is known to Terminal on this machine. It would be nice to find the definitive word as to how and when the paths are set. I've tried to find and learn them all, but just when I think I understand it, even when backed up by experiments, I run into a wall.

I'll take a stab at it -- apologies if I'm wrong:

On a 10.4 system,

* Logging in remotely (from ssh): ssh will run your login shell in login mode -- by default, bash. bash will run /etc/profile, which for most people will set their default path. (default is '/bin:/sbin:/ usr/bin:/usr/sbin')
/etc/profile will (by default) execute /etc/bashrc if it exists


bash will then execute ~/.bash_profile, if it exists.

* Running xterm with no arguments: xterm will start bash in "interactive" (non-login) mode, which causes it to run only ~/.bashrc.

* Terminal.app: If you have the preference set to "Execute the default login shell using /usr/bin/login", it will act like ssh above. Otherwise, like xterm.

* X11.app will append "/usr/X11R6/bin" to your $PATH if you have one, or set your path to "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/ usr/X11R6/bin" if your path is currently empty (see below).

(This string is hardcoded in the X11.app binary; try running "strings /Applications/Utilities/X11.app/Contents/MacOS/X11"

* X11.app will run ~/.xinitrc if it exists, or /etc/X11/xinit/xinitrc if it doesn't. Either of these files might modify $PATH.

The one last wrinkle here is that X11.app's default path depends on how you launch it.
* If you launch it by double-clicking the X11 icon in the Finder, it will have an empty default path, so it will use the hardcoded default path.


* If you launch it by running open-x11 xterm (or whatever) from Terminal.app, it will start with whatever the PATH was set to in the shell from which you launched it.

So, to recap, here are some scenarios and the files that will be executed for each:

1. Double-click X11.app in Finder: PATH = "/bin:/sbin:/usr/bin:/usr/ sbin:/usr/X11R6/bin"; execute ~/.xinitrc or /etc/X11/xinit/xinitrc; execute ~/.bashrc (or /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc)

2. Launch Terminal.app with default prefs: execute /etc/profile, /etc/ bashrc, ~/.bash_profile (or /etc/csh.cshrc, /etc/csh.login, ~/.tcshrc or ~/.cshrc, ~/.login)

3. Run 'open-x11 xterm' from Terminal.app:  the sum of #1 and #2 above.

Ben Byer
CoreOS / BSD
_______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/x11-users/email@hidden

This email sent to email@hidden
References: 
 >Still Happening (From: David Robinson <email@hidden>)
 >Re: Still Happening (From: Michael Reilly <email@hidden>)
 >Re: Still Happening (From: robert delius royar <email@hidden>)
 >Re: Still Happening (From: Martin Costabel <email@hidden>)
 >Re: Still Happening (From: Allan Seidel <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.