Reputation: 10665
I'm using ant to build my project, and use the 'svnversion' executable to insert a version id into my sources for easy tracking of versions.
Running this ant file from the command line works, I've set my $PATH in .profile to include the path to svnversion and it works fine.
Now I try and run this same ant file from inside Eclipse and that does not work - the PATH in eclipse is set in another way than the PATH of the shell, I suspect this has to be set in a plist somewhere, but I don't know where.
Upvotes: 6
Views: 11248
Reputation: 9641
On Mac OS X El Capitan (10.11.5), this works for me for per-user PATH entries (and other environment variables, for that matter).
$HOME/.profile
(if using bash), have your .bash_profile
source that file, and .bashrc
. This should be the entire contents of your .bash_profile
:
# $HOME.bash_profile:
source $HOME/.profile
source $HOME/.bashrc
Near as I can tell, Mac OS does not source .bash_profile
on login for PATH
, presumably because that is often very slow to run (initializing bash completion etc). It does seem to read $HOME/.profile
.
You still need a $HOME/.bash_profile
to trigger bash to read $HOME/.bashrc
, which it otherwise wouldn't do for interactive, non-login terminals as the ones created by Terminal.app
.
Upvotes: 1
Reputation: 27107
Correct -- it's in the plist file
~/.MacOSX/environment.plist
This file actually contains key-value pairs for any environment variables you want to set, for the whole login session. Unlike .profile/.cshrc etc, it's available to GUI programs. Unfortunately, you can't access other environment variables (e.g., you can't use $HOME) or use any other programmatic constructs here.
Update: note that this is no longer supported under OS X 10.8 Mountain Lion, alas.
Upvotes: 6
Reputation: 5750
A quick search at developer.apple.com turned up Setting environment variables for user processes.
Upvotes: 2