1

This question already has an answer here:

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
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

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

marked as duplicate by user151019, bmike Mar 1 '14 at 22:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

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
    
  • 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 .