如何在我的 Mac 上卸载 postgresql(运行 Snow Leopard)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2715055/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 22:29:05  来源:igfitidea点击:

How to uninstall postgresql on my Mac (running Snow Leopard)

postgresqlmacososx-snow-leoparduninstall

提问by wgpubs

Upgraded 10.6 from 10.5 and now postgres 8.1 is whacked. To make things worse I tried installing 8.4 which I'm pretty sure just made things ten times worse. Anyhow, the exception I'm getting when I try to fire postgres up and just createuser is this:

从 10.5 升级到 10.6,现在 postgres 8.1 遭到重创。更糟糕的是,我尝试安装 8.4,我很确定这只会让事情变得更糟十倍。无论如何,当我尝试启动 postgres 而只是 createuser 时,我遇到的异常是这样的:

createuser: could not connect to database postgres: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

createuser:无法连接到数据库 postgres:无法连接到服务器:没有这样的文件或目录 服务器是否在本地运行并接受 Unix 域套接字“/tmp/.s.PGSQL.5432”上的连接?

HOW do I fully get rid of postgres on my Mac so I can do a do-over?

我如何完全摆脱 Mac 上的 postgres 以便我可以做一个重做?

Thanks

谢谢

回答by wgpubs

The problem was with the PostgreSQL account sitting on my machine.

问题出在我机器上的 PostgreSQL 帐户上。

I removed the account and proceeded with the uninstall using the instructions here:

我删除了该帐户并使用此处的说明继续卸载:

Automatic Uninstall:

自动卸载:

In the installation directory, there will be a uninstall-postgresql.app file. Executing (double clicking) that will uninstall the PostgreSQL installation.

在安装目录下,会有一个uninstall-postgresql.app文件。执行(双击)将卸载 PostgreSQL 安装。

Manual Uninstall:

手动卸载:

  1. Stop the server:

    sudo /sbin/SystemStarter stop postgresql-8.3
    
  2. Remove menu shortcuts:

    sudo rm -rf /Applications/PostgreSQL 8.3
    
  3. Remove the ini file:

    sudo rm -rf /etc/postgres-reg.ini
    
  4. Removing Startup Items:

    sudo rm -rf /Library/StartupItems/postgresql-8.3
    
  5. Remove the data and installed files:

    sudo rm -rf /Library/PostgreSQL/8.3
    
  6. Delete the user postgres:

    sudo dscl . delete /users/postgres 
    
  1. 停止服务器:

    sudo /sbin/SystemStarter stop postgresql-8.3
    
  2. 删除菜单快捷方式:

    sudo rm -rf /Applications/PostgreSQL 8.3
    
  3. 删除ini文件:

    sudo rm -rf /etc/postgres-reg.ini
    
  4. 删除启动项:

    sudo rm -rf /Library/StartupItems/postgresql-8.3
    
  5. 删除数据和安装的文件:

    sudo rm -rf /Library/PostgreSQL/8.3
    
  6. 删除用户 postgres:

    sudo dscl . delete /users/postgres 
    

回答by Amir Latifi

I can add this tiny command to the answer too:

我也可以将这个小命令添加到答案中:

rm /usr/bin/psql

Remove executable psql alias.

删除可执行的 psql 别名。

回答by Robert Lujo

If you have newer Postgres and/or OSX/macOS version, you can check this answer.

如果你有更新的 Postgres 和/或 OSX/macOS 版本,你可以查看这个答案