28

Upgraded 10.6 from 10.5 and now postgres 8.1 is whacked. To make things worse I tried installing 8.4 which I'm pretty sure just made things ten times worse. Anyhow, the exception I'm getting when I try to fire postgres up and just createuser is this:

createuser: could not connect to database postgres: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

HOW do I fully get rid of postgres on my Mac so I can do a do-over?

Thanks

wgpubs
  • 7,807
  • 15
  • 61
  • 106
  • How did you install Postgresql, via source or some package install method? – Kuberchaun Apr 26 '10 at 17:03
  • I don't remember how I originally installed it. Wasn't from source. I think it was the install from here: http://www.postgresqlformac.com/ – wgpubs Apr 26 '10 at 17:12

3 Answers3

61

The problem was with the PostgreSQL account sitting on my machine.

I removed the account and proceeded with the uninstall using the instructions here:

Automatic Uninstall:

In the installation directory, there will be a uninstall-postgresql.app file. Executing (double clicking) that will uninstall the PostgreSQL installation.

Manual Uninstall:

  1. Stop the server:

    sudo /sbin/SystemStarter stop postgresql-8.3
    
  2. Remove menu shortcuts:

    sudo rm -rf /Applications/PostgreSQL 8.3
    
  3. Remove the ini file:

    sudo rm -rf /etc/postgres-reg.ini
    
  4. Removing Startup Items:

    sudo rm -rf /Library/StartupItems/postgresql-8.3
    
  5. Remove the data and installed files:

    sudo rm -rf /Library/PostgreSQL/8.3
    
  6. Delete the user postgres:

    sudo dscl . delete /users/postgres 
    
the Tin Man
  • 155,156
  • 41
  • 207
  • 295
wgpubs
  • 7,807
  • 15
  • 61
  • 106
9

I can add this tiny command to the answer too:

rm /usr/bin/psql

Remove executable psql alias.

Amir Latifi
  • 788
  • 8
  • 15
  • 2
    This is closer to the answer than the above. Apple ships with postgres binaries preinstalled (as of Lion, 10.7). There will *not* be the uninstaller that the chosen answer mentions. – Chris Jun 21 '12 at 19:06
  • well the question clearly states that its not lion but snow-leopard (10.6), but nevermind, the chosen answer works perfectly. – zuloo May 18 '13 at 22:55
  • explain what, the line and comment stands on its own. Its an extra line for the answer above or would you rather the entire answer was repeated? – Stevetech Jul 23 '13 at 07:20
  • You will also need to do get rid of all the /usr/bin/pg_* executables (like pg_dump, pg_restore, etc.) – rootsmith Oct 07 '13 at 21:18
  • I think better is to add postgres installation /bin path to the system $PATH instead of removing parts of system. After that you will use versions of psql pg_* same as postgresql server. – cintrzyk Nov 17 '13 at 10:11
  • I get `rm: /usr/bin/psql: Permission denied` when I try this solution. Is there a way around it? – Wilhelm Jul 15 '14 at 16:51
2

If you have newer Postgres and/or OSX/macOS version, you can check this answer.

Community
  • 1
  • 1
Robert Lujo
  • 14,190
  • 5
  • 53
  • 67