13

The order of directories in my path is messed up, and I'm trying to correct it. Some of the path seems to be coming in from somewhere other than my user bash config files (I'm using both .bashrc and .bash_profile).

Is there a system wide bash_profile (or other config files?) file which is executed before user specific ones? If so, where is it located by default?

1
  • The path can also be set in /etc/paths, files in /etc/paths.d/, or in /etc/launchd.conf.
    – Lri
    Commented Aug 14, 2013 at 14:30

1 Answer 1

18

The answer seems to be yes.

Check out the FILE section of Bash Man page

FILES
   /bin/bash
          The bash executable
   /etc/profile
          The systemwide initialization file, executed for login shells
   ~/.bash_profile
          The personal initialization file, executed for login shells
   ~/.bashrc
          The individual per-interactive-shell startup file
   ~/.bash_logout
          The individual login shell cleanup file, executed when a login shell exits
   ~/.inputrc
          Individual readline initialization file

In addition to that, shell paths are also loaded from /etc/paths and the files (if any) in /etc/paths.d by /usr/libexec/path_helper (which is executed as part of /etc/profile).

Lastly, there's also /etc/bashrc, intended for functions and aliases (while /etc/profile is designated for system wide environment and startup programs).

You must log in to answer this question.

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