Why PATH variable is different between 'launching from command line' and 'click the icon' in Mac OS X?

1

1

As I asked in here, I learned that the environment variable of PATH is different depending on how I launch the app.

Using 'aquamacs' from command line is run on top of bash, so the PATH variable is copied to the PATH variable in eshell.

But, how about the clicking the Aquamacs icon method? What PATH variable is set, when I click an app with Mac OS X? And how the PATH variable is set in that way?

prosseek

Posted 2010-09-02T14:26:16.763

Reputation: 4 635

Answers

1

When you run something from the command line, it's created as a child process of the shell you're running within Terminal. As such, it inherits its environment from your shell.

Running by double-clicking, it's not launched by bash but as a child of launchd.

Open up Activity Monitor and choose "All Processes, Hierarchically" to show the parent/child process relationships.

alt text

Setting environment variables for programs not launched from the shell are discussed in other questions such as this one and this one.

Doug Harris

Posted 2010-09-02T14:26:16.763

Reputation: 23 578

Doug's first link is the important one. You can create an XML plist file at ~/.MacOSX/environment.plist to define what environment variables get inherited by GUI apps launched from Finder. – Spiff – 2010-09-02T15:32:15.783