2 versions of pg_dump on my OSX Lion
Asked Answered
M

3

8

I had Postgres 9.0.x installed with homebrew, but because of lack of some modules I removed it using:

brew uninstall postgres

and installed Postgres 9.1.3 from http://www.enterprisedb.com/downloads/postgres-postgresql-downloads.

Now I've got a problem - 2 different versions on pg_dump - 9.0.5 and 9.1.3 and 9.0.5 is the default version.

Is there any way to set the 9.1.3 version as the default version of pg_dump?

Misdoing answered 17/5, 2012 at 12:6 Comment(5)
i found an old version here /usr/binMisdoing
Delete the old version, or rename it, or move it to a directory that it is not in the PATH.Pylorectomy
Why can't you just remove the old binary of pg_dump?Pharyngitis
i did - i moved pg_dump to my home directory (just in case) but now when i type: pg_dump --version in the Terminal i've got: -bash: pg_dump: command not foundMisdoing
This means your new version of pg_dump is not in your PATH.Pharyngitis
P
17

So based on your additional comments, your new version of pg_dump is not in your PATH, all you need to do is to remove the old version, and symlink the new one to any directory in your PATH, for example, /usr/bin.

Like follows:

sudo ln -s /actual/new/pg_dump /usr/bin/pg_dump

Hope this helps

Pharyngitis answered 17/5, 2012 at 12:33 Comment(2)
here is what I did with Homebrew as the upgrade didn't fully work for me. Just change the version number with your postgresql version that Homebrew installed: blog.swathik.com/2013/06/pgdump-version-mismatch.htmlHillock
sudo ln -s /Applications/Postgres.app/Contents/Versions/9.5/bin/pg_dump /usr/bin/pg_dump ln: /usr/bin/pg_dump: Operation not permittedRobertaroberto
C
9

Valentin has the right answer, but of course, the question for Mac users is where the heck is pg_dump?

If you have version 9.2, it's: /Library/PostgreSQL/9.2/bin/pg_dump

Just copy this to /usr/bin

Ceraceous answered 26/12, 2012 at 2:4 Comment(1)
if you used homebrew, it's /usr/local/Cellar/postgresql/9.2.2/bin (or whatever your version is)Meerkat
J
3

I was having the same error essentially.

pg_dump: server version: 9.1.3; pg_dump version: 9.0.4

I just used homebrew's upgrade feature, and it brought both the sever and pg_dump versions up to date with the latest version in homebrew (9.3 as of 9/19/13).

brew upgrade postgresql

I reran my dump statement, and it worked perfectly.

pg_dump -U postgres development > dump.sql

Johnsten answered 20/9, 2013 at 5:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.