Uninstall PostgeSQL – Full Removal Guide for Mac Users

PostgreSQL is a freely-distributed object-relational database management system (DBMS). PostgreSQL is developed by the international developer community and is not controlled by any company or a private person. It is distributed under a free license, which allows the developers to include it in their commercial software products.

PostgreSQL is not typically problematic, but if you get some issues with it, it is recommended to reinstall the program instead of trying to fix the problem. So in this article, we are going to explain how to uninstall PostgreSQL on a Mac easily and quickly.

How to remove PostgreSQL using Terminal

First, you should stop Postgres server on your Mac. For this, click on the Elephant icon in the toolbar and select Shutdown server.

If you installed Postgres with its Installer, then you can use the Terminal command line to remove Postgres. For this, go to the Applications folder →Utilities → open Terminal → and run the uninstaller using the following command:

open /Library/PostgreSQL/9.2/uninstall-postgresql.app

Or try this one

sudo /Library/PostgreSQL/9.1/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh

If you encounter the message that this file does not exist, then skip to Method 2 of PostgreSQL removal. If the command runs the uninstaller, proceed to the next steps.

Enter the administrator password to launch the uninstaller. Then follow the provided steps to remove the PostgreSQL and data folders.
Unfortunately, the root uninstaller doesn’t delete all service files of the program, so you will need to remove them manually. For this, use the commands below:

  1. Remove the ini file:
    sudo rm /etc/postgres-reg.ini
  2. Remove the PostgreSQL folder from the system Library:
    sudo rm -rf /Library/PostgreSQL
  3. Remove the PostgreSQL user. Go to System Preferences → Users & Groups → click the Lock icon and enter the administrator password to unlock settings → select the PostgreSQL and click the “-” icon.  
  4. Restore your shared memory settings using this command: sudo rm /etc/sysctl.conf

That’s all with the first method of removal. Now, let’s learn the second method, which you will most likely find easier and more convenient.

How to Remove and Stop Postgres on Mac using App Cleaner & Uninstaller

App Cleaner & Uninstaller is a removal tool for any kind of program on Mac. With this uninstaller, you can uninstall PostgreSQL well. Here are a few steps to do that:

  1. Download App Cleaner & Uninstaller from the App Store and launch it.
  2. Confirm access to your Applications folder and it will start scanning it to find the installed apps on your Mac. Then you will see a list of apps in the left section. Find and select the PostgreSQL folder. In the right section, you can preview all executable files, support files, cache and all types of file related to PostgreSQL. 
  3. Click the Remove or Uninstall button and confirm the removal of the selected files. 

Note that App Cleaner & Uninstaller automatically detects all the support files of the apps, so you don’t need to search for and remove them manually. If you already deleted PostgreSQL in the regular way, you can find the leftovers of the program in the Remains tab.

That’s all. As we promised, easy and fast! You can learn more about the additional features of App Cleaner from this link.

Articles you may be interested in: