sean
sean

Reputation: 3634

Mac OS X 10.11 - Add Postgres to $PATH Unsuccessful

I am trying to install Postgres in order to use Heroku.

I am following the instructions in the Heroku tutorial, and after Postgres installation (which was successful), it says to configure my .bash_profile to allow for Postgres command line functionality.

I am following the instructions here, but I am unable to successfully add this line:

export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin

That folder does in fact contain "psql" on my computer, so it should work. Here is my current .bash_profile:

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

# The next line updates PATH for the Google Cloud SDK.
source '/Users/user/google-cloud-sdk/path.bash.inc'

# The next line enables shell command completion for gcloud.
source '/Users/user/google-cloud-sdk/completion.bash.inc'

I tried to add the Postgres line to the end of that file, but it is not working. After searching online, there does not seem to be consensus on how to add PATHs to .bash_profile. I have tried many versions listed, but none have worked.

Please let me know if I'm doing this incorrectly!

Upvotes: 0

Views: 1699

Answers (1)

Ghost
Ghost

Reputation: 1523

Add this line to the end of your .bash_profile:

export PATH=/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH

This makes the search of a binary to look in that location "BEFORE the rest of the PATH"

Kill all instances of terminal and open it again, then it should work.

Try which xxx where xxx is the name of some binary inside /Applications/Postgres.app/Contents/Versions/latest/bin and check if it's returning that location.

Tell me if it works.

Upvotes: 7

Related Questions