How to Completely Uninstall PostgreSQL on Your Mac

Remove PostgreSQL on your Mac

PostgreSQL is helpful for coding, but you might want to uninstall it from your Mac at some point. Compared to normal macOS apps, which you can delete in Finder, getting rid of PostgreSQL is a bit more difficult. But fear not because I’ll show you what you need to do today.

To ensure that you remove everything, let’s delete your user account as well. And if you’re struggling to remove the app or your account, you’ll also find out what you can do to address these changes.

Reasons to Uninstall PostgreSQL on Your Mac

While PostgreSQL is a useful piece of software, you might no longer need to use it because you’ve picked an alternative. However, it’s also possible that the app isn’t working for whatever reason; uninstalling and reinstalling programs that aren’t acting as they should often make it easier to solve the issue.

Note icon NOTE
If you’re having problems with apps on your device, you can often remove them via Finder. However, if Finder itself isn’t working, you could have problems performing your desired actions. This guide on what to do if Finder isn’t responding on your Mac should help you achieve your goals.

How to Uninstall PostgreSQL on Your Mac

Regardless of your reasons for wanting to uninstall PostgreSQL on your Mac, the process is identical. First, you’ll need to delete the app. And after doing that, you should delete your user account.

In the sections below, you’ll learn how to do both.

1. Use the Terminal App

Time needed: 10 minutes

One of the main ways to uninstall PostgreSQL on your device is via the Terminal app. You’ll have to enter a couple of different commands, and I’ll show you the entire process from start to finish below.

  1. Go to Spotlight by clicking on the magnifying glass icon in the top right-hand corner of your Mac toolbar.

    Choose Spotlight in your Mac Toolbar

  2. When the pop-up search window appears, type Terminal. You don’t need to hit the Return key; the results should automatically appear within a few seconds.

    Choose Terminal in Spotlight

  3. Select the Terminal app when it shows up — you should see it as the top result.

  4. When the Terminal app opens, type open /Library/PostgreSQL/version number/uninstallpostgresql.app. If that doesn’t work, try sudo /Library/PostgreSQL/version number/uninstall-postgresql.app/Contents/MacOS/installbuilder.sh.

    Uninstall PostgreSQL in Mac Terminal via a command

  5. Hit the Return key, enter your password, and follow the uninstallation instructions on your screen.

2. Delete Your User Account

After removing PostgreSQL, you should also delete your user account to free up space on your device. Note that you can only do this for accounts that you aren’t signed into; if you need to delete the main account on your Mac, you should make a new one first.

Here’s how to delete your user account:

  1. Tap the Apple icon in the top left-hand corner. Then, select System Settings when the drop-down menu appears.
    System Settings Option on Mac Menu Bar
  2. Go to Users & Groups in the toolbar on the left.
  3. Find your account and select the information icon (i).
    Go to Users & Groups > Information Icon in System Settings
  4. When the next pop-up window appears, click on Delete User.
    Delete a User on Your Mac
  5. Another pop-up window will then show up on your Mac. When it does, choose whether you want to save any user settings and then press Delete User again.
    Confirm that you want to delete a user on your Mac
Note icon NOTE
Sometimes, you’ll have to delete other PostgreSQL files and folders on your device. You can do this by going to Terminal and typing sudo rm -rf /Library/PostgreSQ — after doing that, hit Return and type in your password.

What to Do if PostgreSQL Won’t Uninstall

If you’ve done everything listed above but you haven’t been able to completely get rid of PostgreSQL, you can try a few more things to solve the issue. From restarting your computer to restoring it to a previous version, here are four things to attempt.

1. Restart Your Mac and Try Again

The easiest place to start is by rebooting your Mac and then trying to uninstall PostgreSQL again, along with deleting your account. It doesn’t matter if you shut down your device and manually turn it back on or automatically restart everything, but the latter requires less manual work and I’ll therefore show you how to do that.

  1. Go to the Apple menu icon and expand the dropdown menu.
  2. Select Restart.
    restart mac
  3. Confirm that you want to restart your Mac in the pop-up window. If you do nothing for 60 seconds, your device will automatically turn off and on.
    The pop-up window to restart a Mac
  4. Wait for your Mac to fully restart. When the login page appears, enter your password like you normally would when switching on your device.
  5. Go to Terminal and try to uninstall PostgreSQL by following the same steps outlined in the first section.

2. Use Terminal

In addition to the commands I’ve already said that you should use, there’s another option to remove your data in Terminal. Here’s how to use it:

  1. Go to Spotlight and search for Terminal.
  2. When Terminal opens, type sudo rm /etc/postgres-reg.ini and hit the Return key.
  3. Enter your password. This should remove excess data from the app.
  4. Type the other two commands again that I mentioned earlier, and hit your Return key for both. Input your password to remove these.
  5. Turn your Mac off and on again.

3. Check Your Admin Permissions

Most of the time, only people with administrative permissions can delete apps and programs on a Mac. So, if you can’t delete PostgreSQL, it could be due to your account’s permissions. You can check and adjust these by going to System Settings:

  1. Open System Settings and select Users & Groups.
  2. Select the information icon next to your user account.
    Go to Users & Groups srcset= Information Icon in System Settings”>
  3. Toggle Allow user to administer this computer on.
    Administer Mac Computer Toggle
  4. A pop-up window will appear and tell you that you have to restart your computer. When it appears, select OK.
    Mac User Admin Window Confirmation
  5. Restart your Mac to bring the new conditions into effect.

4. Restore Your Mac to a Previous Version

Restoring your Mac to a previous version is the most inconvenient way to remove PostgreSQL, and you’ll use a lot of saved data if it didn’t exist at that previous point. However, if all else has failed so far, it is a possibility. If you need to go to those lengths, you can follow these instructions:

  1. Open Spotlight and search for Migration Assistant before opening the app.
    Select Migration Assistant in Spotlight on Mac
  2. Select Continue. This will close all open apps on your device, so make sure that you’ve saved everything.
    Select Migration Assistant and tap Continue
  3. In Migration Assistant, you’ll see three options. Tick the circle next to From a Mac, Time Machine, or Startup disk, and select Continue.
    Select Continue in Mac Migration Assistant
  4. Choose the Time Machine backup for which you want to restore your computer. Then, press Continue again.
    Mac Time Machine Settings
  5. Tick all of the information you want to restore on your device. Select Continue once more.
    Mac Choose Time Machine Backup
  6. Wait for your Mac to restore.

Deleting PostgreSQL normally isn’t a complicated process, and it shouldn’t take you more than 10 minutes. You’ll first need to delete the app and any data associated with it, before then removing your account. If you’re unable to do these, there are a handful of things you can try to fix the issue. Hopefully, having read this article, you can now remove PostgreSQL without further issues.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.