1

This question already has an answer here:

I'm on a Mac, but this seems like a UNIX/Linux question. I just installed Postgres.app, and the documentation says to add the /bin directory that ships with Postgres.app to your PATH by adding the following line to .bashrc, it'll get set for every terminal session:

PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

Should I be exporting that, or just keep it as is?

marked as duplicate by Chris Down, Bernhard, Anthon, goldilocks, Ramesh Jun 22 '14 at 19:57

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
    I think you should do an export of the PATH – Boogy Jan 23 '14 at 7:17
  • @Chris That is about dir:$PATH versus $PATH:dir, while this question is about export PATH= versus PATH=. Still a duplicate of another question though. -edit- only now I see this question is much older – Bernhard Jun 22 '14 at 12:09
  • Yes, use export, but first read: unix.stackexchange.com/questions/124444/… – goldilocks Jun 22 '14 at 15:54
1

export puts the variable in the program environment, which is propagated to forked processes. If you want any processes you launch to know about the new location, you need to export it (although if it is already exported, you don't need to use export again, but it does no harm to do so).

If you want to be totally sure, export it. If it is already in your environment, though, you do not need to do it again.

  • Once a variable is exported, it stays exported, and further assignments modify the environment variable. So export isn't actually needed there. Timo's (deleted) answer is correct regarding this. – Gilles Jun 22 '14 at 11:21
  • @Gilles That's what I said in the parenthesized sentence. Did I say something in this answer that you think contradicts that? I can't see anywhere I suggested otherwise, unless you're referring to my advice to export it anyway, which is just to avoid missing the export in environments without a PATH to begin with. – Chris Down Jun 22 '14 at 11:30
  • “The answer is probably yes” — actually, the answer is probably no. By the way, do you have an opinion on closing this as a duplicate of unix.stackexchange.com/questions/26047/… (which answers this but is more general so the answer is buried in other considerations)? chat.stackexchange.com/transcript/message/16211821#16211821 – Gilles Jun 22 '14 at 11:32
  • @Gilles The question is "should I", not "do I have to". I take "should I" to mean "does it decrease the likelihood of something unexpected happening", not "is it typically necessary". I would support closing as a duplicate, yes. – Chris Down Jun 22 '14 at 11:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.