I am trying to use /etc/paths.d to add an executable to my path variable but I have no success so far.

The full path of the executable file is: /opt/ImageMagick/bin/convert

/etc/paths.d contains two files: 40-XQuartz and ImageMagick

The 40-XQuartz contains one line: /opt/X11/bin
The ImageMagick contains one line: /opt/ImageMagick/bin

My echo $PATH gives:


So it seems that only the first file (40-XQuartz) does its job. The permissions of the two files (40-XQuartz and ImageMagick) are exactly the same so my question is why the first one works and the second one is not.

I am running OS X Mavericks.


3 Answers 3


Have you started a new login shell since adding the new file for ImageMagick? The setting of the path from paths.d entries is done in /etc/profile and /etc/csh.login, so you need to start a new shell for the new entries to take effect.

OS X uses path_helper to set the path based on the files in /etc/paths.d - you can always call it manually (assuming a Bourne-like shell here):

$ eval `/usr/libexec/path_helper -s`
  • Of course I have started a new shell.I even restarted my mac.
    – skiabox
    Commented Apr 27, 2014 at 17:10
  • new login shell worked for me Commented Sep 9, 2016 at 20:23
  • @mjturner when using your command it reorders my paths putting paths I have in .bash_profile below the paths that are in etc/paths.d. Is there a way around that?
    – John
    Commented Aug 28, 2020 at 4:26
  • @John What do you have in .bash_profile'? You may need to adjust how you set PATH` so that your preferred directories are first.
    – mjturner
    Commented Aug 28, 2020 at 12:07
  • 1. PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 2. export PATH 3. PATH=$PATH:/usr/local/opt/nano/bin 4. PATH=$PATH:/usr/local/sbin
    – John
    Commented Aug 28, 2020 at 13:28


echo /opt/ImageMagick/bin|sudo tee /etc/paths.d/ImageMagick;bash -l;echo $PATH

adds /opt/ImageMagick/bin to PATH on my installation.

Are you overriding PATH in some other place like ~/.bash_profile?

The paths in /etc/paths.d/ are added to the path by /usr/libexec/path_helper, which is run from /etc/profile, /etc/zsh.env, and /etc/csh.login. path_helper is not run by graphical applications or when bash is invoked as a non-login shell.

You can also set a default PATH in /etc/launchd.conf:

  1. Run for example setenv PATH /Users/Administrator/.rbenv/shims:/Users/Administrator/.rbenv/bin:/Users/Administrator/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/ImageMagick/bin|sudo tee -a /etc/launchd.conf.
  2. Either restart, or run launchctl</etc/launchd.conf;sudo launchctl</etc/launchd.conf and relaunch processes.

I prefer changing the path in /etc/launchd.conf, because it also affects programs that are not started from shells, like text editors and programs started by launchd jobs.


Awesome, I was just playing around with adding ImageMagic to my Mac. Not only do you need ImageMagick/bin in your PATH, you also need an environment variable set, or added to:

To test you can create it manually with:

export DYLD_LIBRARY=".:/opt/ImageMagic/lib"

Information for setting an environment variable for Mac OS can be found here, Setting environment variables in OS X?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .