How to brew uninstall postgres on OX Sierra

31,695

I installed postgres using homebrew. I uninstalled it using the following steps:

Run the following command and look for the correct name something like postgresql94, postgres, postgresql@13. Name may varies, you have to check accordingly. In my case it was postgresql94.

brew list

After finding the correct name, run the following command to uninstall postgres. You have to replace postgresql94 with the name you found in the above mentioned command:

brew uninstall postgresql94

That should do the uninstall.


Shortcut command for the same is

brew list | grep postgres | xargs brew uninstall
Share:
31,695
stackjlei
Author by

stackjlei

Updated on August 29, 2021

Comments

  • stackjlei
    stackjlei over 2 years

    Reading from the here, I want to uninstall postgres completely with homebrew and have used brew uninstall postgresql but I get this response.

    No such keg: /usr/local/Cellar/postgresql
    

    I know postgres is running because when I run ps auxwww | grep postgres I see /usr/local/opt/postgresql94/bin/postgres -D /usr/local/var/postgres. What am I doing wrong? I have mac Sierra

  • stackjlei
    stackjlei over 7 years
    THANKS! I did this and the uninstallation happened super quick so I did ps auxwww | grep postgres and still see the process running though. is that normal?
  • Prashant Pokhriyal
    Prashant Pokhriyal over 7 years
    did you run it using root privileges. I think you are still able to see process because some file cannot be removed because they are currently in use.
  • stackjlei
    stackjlei over 7 years
    I think I have root privileges because I'm the only one using my computer. Was I suppose to add sudo before the brew uninstall postgresql? I restarted my computer and don't see it the process anymore
  • Prashant Pokhriyal
    Prashant Pokhriyal over 7 years
    Actually process file is still there but now it is not able to run because all the dependent files are deleted. So it's not running.
  • Katarzyna
    Katarzyna about 6 years
    If you use homebrew why do you use sudo? Sudo works outside of Homebrew. Normally it might break things. Is it ok for removing stuff on Mac with brew with sudo?
  • ankush981
    ankush981 about 3 years
    In 2021, using sudo causes an error. Looks like Homebrew allows us to install and uninstall as regular users now (at least for Postgres).
  • Mel
    Mel almost 3 years
    sudo brew uninstall [email protected] Password: Error: Running Homebrew as root is extremely dangerous and no longer supported. As Homebrew does not drop privileges on installation you would be giving all build scripts full access to your system.
  • Prashant Pokhriyal
    Prashant Pokhriyal over 2 years
    I've updated my answer. Earlier I used sudo which is not required now.