Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to uninstall postgres on Mac OS 10.6 and start again with a completely fresh installation and empty databases.

I've killed all running postgres processes and tried to delete the postgres data directory, but no joy (see below): six databases are still there.

I've also tried to find the PGDATA variable, but it seems to be blank. Where are these databases living?

delirium:~ ap257$ kill 7495
delirium:~ ap257$ sudo su - postgres
Password:
delirium:~ postgres$ rm -rf /usr/local/pgsql/

[reinstall postgres from binaries]

delirium:~ ap257$ sudo su - postgres
Password:
delirium:~ postgres$ export PATH=$PATH:/usr/local/pgsql/bin/
delirium:~ postgres$ psql
Password: 
psql (8.4.4)
Type "help" for help.
postgres=# \l
                                 List of databases
       Name       |  Owner   | Encoding | Collation | Ctype |   Access privileges   
------------------+----------+----------+-----------+-------+-----------------------
 osqa             | postgres | UTF8     | C         | C     | =Tc/postgres
                                                            : postgres=CTc/postgres
                                                            : osqa=CTc/postgres
 postgres         | postgres | UTF8     | C         | C     | 
 production       | postgres | UTF8     | C         | C     | =Tc/postgres
                                                            : postgres=CTc/postgres
                                                            : anna=CTc/postgres
 template0        | postgres | UTF8     | C         | C     | =c/postgres
                                                            : postgres=CTc/postgres
 template1        | postgres | UTF8     | C         | C     | =c/postgres
                                                            : postgres=CTc/postgres
 template_postgis | postgres | UTF8     | C         | C     | 
(6 rows)
postgres=# \q
delirium:~ postgres$ echo $PGDATA

Why won't these databases die?

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

You can always do a lsof | grep pg or something like that (Postgres) to see if there's anything open by some postgresql related process. pg is rather vague but I'm sure it won't be too much to sift through.

share|improve this answer
    
Hm, not much there... see update above. –  AP257 Aug 2 '10 at 12:04
    
What I'd really like to do is log into postgres, and then ask it where it's storing the six databases that I can't delete. Is this possible? –  AP257 Aug 2 '10 at 12:05
    
The great thing about OS X is that is has an app called Instruments. At Templates, look under the Mac OS X section on the left and select Filesystem under the Mac OS X group. Select and Choose File Activity. Set the default target to all processes, press the record button and do your thing with postgres ASAP that shows the databases (haven't figured out how to attach to a terminal process yet). Then stop the recoding. Do it quickly and you won't have much to sift through. –  crazysim Aug 2 '10 at 20:51
    
Thanks - good suggestion. A reboot fixed the problem in the end. –  AP257 Aug 4 '10 at 13:40
add comment

Your process 7495 is a python process using your postgresql database.

share|improve this answer
    
Sorry, I had Pylons running somewhere else. I've done 'kill 7495' and these processes have vanished. However, as I suspected, if I log into postgres, I can still see the six databases that I want to die, even if I delete the /data directory. How can I kill them and do a completely fresh install? –  AP257 Aug 2 '10 at 12:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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