Here is the correct way to uninstall PostgreSQL on Mac

If you’ve installed PostgreSQL on your Mac for a project and no longer need it, it’s a good idea to uninstall it. That will help free up space on your Mac and prevent the possibility of conflicts with other files and software that could cause problems. In this article, we’ll explain the options for uninstalling PostgreSQL.

What is PostgreSQL?

Dating all the way back to 1982, PostgreSQL is a system for managing relational databases that is focused on allowing users to extend their capabilities and SQL compliance. It was the default database for macOS Server, but it also runs on Windows, Linux, FreeBSD, and OpenBSD. It’s free and open source. It can handle workloads on individual machines, web services, and data warehouses and support multiple concurrent users. It can also be used with services like Amazon AWS.

Why uninstall PostgreSQL?

The main reason for uninstalling it, as with any tool you no longer use, is to prevent problems further down the line. If you’re not using software, it’s unlikely that you will keep it updated. And out of date software is a common cause of conflicts and can even leave your Mac vulnerable to malware attacks.

How to uninstall PostgreSQL manually

There are two options for uninstalling. One easy, one not so easy. Let’s tackle the not-so-easy method first; then, we’ll show you the easy way. You’ll need to use the Terminal for this, but if you’ve used PostgreSQL, using the Terminal shouldn’t be an issue.

First, though, you need to shut down the server if it’s running on your Mac: click the elephant icon in the toolbar and choose “Shutdown server.”

Next, there are a couple of options for Terminal commands, depending on how you installed PostgreSQL. Try them in the order below. Only use the second one if the first is unsuccessful.

  1. Go to Applications > Utilities and launch Terminal.
  2. Type the following command: open /Library/PostgreSQL/9.2/uninstall-postgresql.app
  3. Press Return and type in your admin password when prompted.
  4. Follow the instructions on screen.

If that doesn’t work, use this command

  • Type this command then hit Return: sudo /Library/PostgreSQL/9.1/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh
  • Type in your admin password when prompted.
  • Follow the instructions on screen.

It’s possible that even though the Terminal commands above uninstall PostgreSQL, they will leave files on your startup disk. To get rid of those, you will need to run a couple more commands in Terminal.

  1. Type: sudo rm /etc/postgres-reg.ini
  2. Press Return.
  3. Type: sudo rm -rf /Library/PostgreSQL
  4. Press Return.

Finally, you will need to remove the PostgreSQL user account from your Mac.

  • Click the Apple menu and choose System Preferences.
  • Choose Users & Groups.
  • Click on the padlock and type in your admin username and password.
  • Select the PostgreSQL user.
  • Click the ‘-‘ at the bottom of the window.
  • Quit System Preferences.

PostGresSQL should now be completely uninstalled.

How to uninstall PostgreSQL the easy way

Now that we’ve shown you the manual and lengthy method for uninstalling PostgreSQL let’s take a look at a much easier way. This method uses a tool that’s designed to uninstall apps and drivers and can also reset them to the state they were in when you first installed them if they run into trouble. The tool is CleanMyMac X, and as well as uninstalling and resetting apps, it has a bunch of other modules that can clear the clutter from your Mac and keep it running smoothly. You can download it for free here.

All apps selected in the Uninstaller module of CMMX

  1. Launch CleanMyMac X.
  2. Choose Uninstaller in the left sidebar.
  3. Search for PostgreSQL and check the box next to it.
  4. Click Uninstall.

That’s it. That’s all you need to do to completely uninstall PostgreSQL with CleanMyMac X.

PostgreSQL is a relational database management tool that may have been installed on your Mac by you or a previous user. If you don’t use it anymore, follow the steps above to uninstall and remove all of its files from your Mac.

Laptop with CleanMyMac
CleanMyMac X

Your Mac. As good as new.