I've added maven to my path, but it doesn't seem to be persisting to the path beyond the lifetime of the terminal application. I've modified my ~/.bashrc, but it still isn't storing the modified path.

Here is my ~/.bashrc:

export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
export PATH=$PATH:/Users/chris/Dev/Libraries/apache-maven-3.1.1/bin

And here is the result of echo $PATH:

chriss-macbook:~ chris$ echo $PATH

Why isn't my modified path getting persisted between terminal sessions, and how can I solve that?


OS X Terminal does not source ~/.bashrc. Instead, it sources ~/.bash_profile. Either…

  • Put the lines that are in your ~/.bashrc in your ~/.bash_profile instead.

  • Source your ~/.bashrc in your ~/.bashprofile.

    Add the following line to your ~/.bashprofile:

    [[ -s ~/.bashrc ]] && source ~/.bashrc
|improve this answer|||||
  • An old answer, but it's still important to point out that it's better to get people to understand how bash sources init files vs making absolute pronouncements. The OP should have been pointed to the INVOCATION section of the bash man page where the different init files, and how and when bash uses each one, are spelled out. – Marc Wilson Sep 15 '18 at 15:56

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