/etc/launchd.conf is no longer supported in 10.10. See man launchctl:
The /etc/launchd.conf file is no longer consulted for subcommands to run during early boot time; this functionality was removed for security considerations.
You can now for example save this plist as ~/Library/LaunchAgents/my.startup.plist:
<?xml version="1.0" encoding="...
I have a .profile in my home directory; it contains many export … statements for environment variables.
You can create such a file by opening a Terminal and issuing the command touch .profile
Then you should open that file in a plain-text editor (TextWrangler for example). You can also use nano .profile in a Terminal window (current ...
I know this is an old question but I thought I would point out that in Yosemite /etc/launchd.conf no longer works (as confirmed by the man page). So here is an alternative.
Launch AppleScript Editor, enter a command like this:
do shell script "launchctl setenv variablename value"
(add as many lines as you like)
Now save (⌘S) as File format: Application. ...
I asked this question on the Apple Developer Forums as well and got back this, official response.
Change the Info.plist of the .app itself to contain an "LSEnvironment"
dictionary with the environment variables you want.
~/.MacOSX/environment.plist is no longer supported.
Try adding the following line to your .bash_profile file.
You can do this easily with the following command, which will append the line if the file already exists or create a new file with the line if it doesn't.
echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bash_profile
The correct file, prior to Mavericks, was ~/.MacOSX/environment.plist. This is no longer supported.
In Darwin, and therefore in Mac OS X, the proper place to set these is in /etc/launchd.conf to apply to all processes; if relating to user shells specifically, use the appropriate shell files instead, depending on the shell in question. See the launchd.conf ...
After many trials with different options I conclude:
Is there a unified way to set the PATH for applications launched by different means (like shell script, Finder and Spotlight)? Well, yes and no:
No: Setting PATH in shell start up scripts (e.g. .bashrc) works only for apps launched by shells.
No: Setting PATH for the current launchd process via launchctl ...
There is a much easier way. Place a text file in the folder /etc/paths.d/. In this text file, enter the desired path AND a newline. The best way is to create a new file for each path.
On my system, there is a file called MySQL with the text '/usr/local/mysql/bin' and a newline.
As you have discovered, the use of environment.plist file is no longer followed, the variables stored in Info.plist as LSEnvironment strings are only set by launchd.
You cannot depend on them to set a general environment variable that the terminal will set if you call your program from the terminal/shell directly. The good news is the open -a command does ...
If you are using bash, then setting the environment variables in /etc/profile will apply for all users.
From the bash manual on OS X Mavericks, with my emphasis (this has not changed from previous versions):
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands ...
With Mountain Lion /etc/launchd.conf is where you should set the GUI applications Path. Remember it's not a script file; it only supports launchctl commands so you should write something like:
setenv PATH /new/path:/usr/bin:/bin:/usr/sbin:/sbin
Note also that it doesn't support shell environment variable substitutions (like $PATH) so you'll have to set ...
This is System Integrity Protection introduced in El Capitan
Documentation is in this from Apple
Basically any Apple supplied OS X executables are protected. and (from an earlier document)
Spawning children processes of processes restricted by System Integrity Protection, such as by launching a helper process in a bundle with NSTask or calling the exec(...
The loginwindow process sets a user's environment. It sets the variables TMPDIR and PATH, consults Directory Services and sets SHELL HOME USER LOGNAME . PATH is set to /usr/bin:/bin:/usr/sbin:/sbin unless modified by launchd (in the more current versions of OS X). This is the PATH variable available to the user's processes unless modified by that particular ...
Run touch ~/.bash_profile; open ~/.bash_profile
In TextEdit, add
Save the .bash_profile file and Quit (Command + Q) Text Edit.
Run source ~/.bash_profile
If you look in your console, you'll probably see a message about sandboxd preventing gs from running. Just add this line to the end of /etc/cups/cups-files.conf:
sudo launchctl stop org.cups.cupsd
I'm going to lump together 1 & 2 because all shells read files at startup.
PATH is inherited from its parent process. This is a key concept that you need to understand.
The PATH is first hard coded into the kernel:
launchd which acts as init can be configured to change this PATH. ...
You need to explicitly start an interactive bash shell at the end of your script in order to keep the window open when you open the .command file from Finder.
The following revision of your script demonstrates that and also streamlines other aspects of your code:
# Note: $PATH already exists as an exported variable, assigning to it
For adding a directory to a path, there is a better option in OS X:
All entries in the file /etc/paths are added to the path, before any shell is started.
Edit this file with:
sudo pico /etc/paths
For more info, see: https://gist.github.com/Overbryd/1669348
What you (and anyone else finding this question) are almost certainly looking for is the following path:
You can always put your edits into the /private/etc/paths.d if you want to avoid changing the main system default "paths" configuration document, but then they will be appended to the end of your $PATH variable, so if you want to add ...
You can accomplish this by going to your .bash_profile file and adding these lines to it.
alias mysql.start="sudo /usr/local/mysql/support-files/mysql.server start"
alias mysql.stop="sudo /usr/local/mysql/support-files/mysql.server stop"
alias mysql.restart="sudo /usr/local/mysql/support-files/mysql.server restart"
alias mysql.status="sudo /usr/local/mysql/...
For the sake of clarity, I will refer to this solution as the static solution, the second solution as the dynamic solution,
and finally this one as the launch agent solution. I am going to compare the static and dynamic solution with the launch agent one, respectively.
The static solution involves the editing of /etc/launchd.conf. This has the advantage, as ...
Setting environment variables in /etc/launchd.conf is the way to go: Every application launched after a reboot by local shells, Finder or Spotlight inherits these variables - I have tested this extensively with Mountain Lion 10.8.3.
Shells might overwrite the settings in their login scripts. (See For correct functioning in shells though...)
OSX has had only one change re environment variables and that was in Lion where ~/.MacOSX/environment.plist was removed. Although there also has been a change in the default shell in 10.2 or 10.3 from tsch to bash.
You need to define what you want the enviroment variable set for and what environment you have.
You also need to understand shells and Unix ...
Just for the sake of anyone who might come along and wonder how to restrict this to only when the TERM is a certain value, you could put something like this in your shell's "rc" file (.zshrc or .bashrc etc):
case "$TERM" in