Mismatching pg_dump on MacOS X

Viewed 5742

Locally, it appears that I have Postgresql 9.2.4 installed. I am guessing based off the last error message I received that I do not have the latest version:

pg_dump: server version: 9.3.1; pg_dump version: 9.2.4
pg_dump: aborting because of server version mismatch

On other posts here, what was told to do was to add the following the the .profile and then run the command:

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

which did not work.

2 weeks ago, I installed Postgresql with the simple command:

brew install postgresql

and that gave me the version I currently have. It appears as I don't have the latest version then.

How can I a) upgrade to 9.3.1 (which is what the server version looks to be) or b) do one of these fixes like the one I attempted above which did not work.

I am very new to Postgresql so a step by step would be very helpful for me.

3 Answers

Solved by adding this at the end of my ~/.bash_profile ( or ~/.zshrc for zsh)

export PG_DUMP="/Applications/Postgres.app/Contents/Versions/9.6/bin/"
PATH=$PG_DUMP:$PATH

Don't forget to run (for bash shell)

$ source ~/.bash_profile

or (for zsh)

$ source ~/.zshrc

You can check the path of pg_dump by running

$ which pg_dump
 ==> /Applications/Postgres.app/Contents/Versions/9.6/bin//pg_dump
  • MacOS Mojave (10.14.2)
  • Postgres.app (2.1.5)
  • PostgreSQL 9.6
Related