This question may look like a duplicate of: How to uninstall postgresql on my Mac (running Snow Leopard) however, there are two major differences. I\'m running Lion and I\'m
Uninstallation :
sudo /Library/PostgreSQL/9.6/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh
Removing the data file :
sudo rm -rf /Library/PostgreSQL
Removing the configs :
sudo rm /etc/postgres-reg.ini
And thats it.
Incase you have multiple versions of Postgres installed on your machine. You can remove all via brew
command as:
brew uninstall --force postgresql
If you installed using the graphical installer by BigSQL from the official postgres site and if you installed in the default location...
You can find your uninstaller in your home directory: /Users/<yourusername/PostGreSQL/uninstall/
open terminal and type the below command and hit enter
sudo /Library/PostgreSQL/9.X/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh
The following is the un-installation for PostgreSQL 9.1 installed using the EnterpriseDB installer. You most probably have to replace folder /9.1/ with your version number. If /Library/Postgresql/
doesn't exist then you probably installed PostgreSQL with a different method like homebrew or Postgres.app.
To remove the EnterpriseDB One-Click install of PostgreSQL 9.1:
Run the uninstaller:
sudo /Library/PostgreSQL/9.1/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh
If you installed with the Postgres Installer, you can do:
open /Library/PostgreSQL/9.2/uninstall-postgresql.app
It will ask for the administrator password and run the uninstaller.
Remove the PostgreSQL and data folders. The Wizard will notify you that these were not removed.
sudo rm -rf /Library/PostgreSQL
Remove the ini file:
sudo rm /etc/postgres-reg.ini
Remove the PostgreSQL user using System Preferences -> Users & Groups.
Restore your shared memory settings:
sudo rm /etc/sysctl.conf
That should be all! The uninstall wizard would have removed all icons and start-up applications files so you don't have to worry about those.
This blog post explains very well:
(just replace 9.X by your version. e.g: 9.6)
A. If installed PostgreSQL with homebrew, enter brew uninstall postgresql
B. If you used the EnterpriseDB installer, follow the following step.
Run the uninstaller on terminal window: sudo /Library/PostgreSQL/9.X/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh
C. If installed with Postgres Installer, do:
open /Library/PostgreSQL/9.X/uninstall-postgresql.app
Remove the PostgreSQL and data folders. The Wizard will notify you that these were not removed.
sudo rm -rf /Library/PostgreSQL
Remove the ini file:
sudo rm /etc/postgres-reg.ini
Remove the PostgreSQL user using System Preferences -> Users & Groups.
Unlock the settings panel by clicking on the padlock and entering your password.
Select the PostgreSQL user and click on the minus button.
Restore your shared memory settings: sudo rm /etc/sysctl.conf