1

echo $PATH shows:

/usr/local/bin:/opt/local/bin:/opt/local/sbin://anaconda/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/stefankaros/bin/FDK/Tools/osx

my ~/.bash_profile is:

# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

# added by Anaconda 2.0.1 installer
export PATH="//anaconda/bin:$PATH"

# Initialization for FDK command line tools.Tue Oct  7 20:01:15 2014
FDK_EXE="/Users/stefankaros/bin/FDK/Tools/osx"
PATH=${PATH}:"/Users/stefankaros/bin/FDK/Tools/osx"
export PATH
export FDK_EXE

# MacPorts Installer addition on 2014-10-22_at_21:44:05: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.

export PATH=/usr/local/bin:$PATH

I do not have .bashrc or any other file that starts with .bash in my home dir. in my PATH,where does the opt/x11/bin come from? why is use/bin duplicated? In my .bash_profile, what does export FDK_exe do? PATH was just exported in the line before?

Lee Duhem
  • 14,695
  • 3
  • 29
  • 47
aquagremlin
  • 3,515
  • 2
  • 29
  • 51
  • 2
    unix.stackexchange.com would be a better place to ask where the initial value of `$PATH` comes from. – Barmar Oct 23 '14 at 03:02
  • 1
    It's probably coming from `/etc/profile` or `/etc/bashrc`. Or it may be inherited from `init`. – Barmar Oct 23 '14 at 03:03
  • Given that the system is Mac OS X, maybe [Ask Different](http://apple.stackexchange.com/) is an appropriate place to ask. – Jonathan Leffler Oct 23 '14 at 03:08
  • Funny or depressing? How all of these guys think they have to `export PATH` even though it's basically guaranteed to be exported already. – tripleee Oct 23 '14 at 06:05

1 Answers1

1

On Mac OS X, there is a file /etc/paths which contains (on my Yosemite machine):

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

These are the elements on your PATH that you don't set explicitly in your .bash_profile. There's also a directory /etc/paths.d but that's empty on my machine. See also man path_helper and /usr/libexec/path_helper, called from /etc/profile.

You could clean up your PATH to remove duplicate elements. See How to keep from duplicating PATH variable in csh — which has relevant answers even if you use Bourne shell derivatives.

Community
  • 1
  • 1
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • yep! that's where it came from. thanks. i guess i can edit my .bash_profile in confidence now! – aquagremlin Oct 23 '14 at 03:19
  • OK; what you showed certainly matched `/etc/profile` on my machine — but it could have been copied to `/etc/bashrc` (though it would not be a good idea to have done so). I could add the files to my answer, but I don't think they add all that much value. – Jonathan Leffler Oct 23 '14 at 03:25