Mac brew 安装Postgres 开机自启动

以下所有命令在mac 终端执行

 

1、安装postgres

brew install postgres

 

2、brew 安装的程序都可以在/usr/local/Cellar/下找到,去/usr/local/Cellar/postgresql/12.1下找到   (12.1是我的版本,具体路径还要看你安装的什么版本)

homebrew.mxcl.postgresql.plist 文件

 

3、链接到  ln -s /usr/local/Cellar/postgresql/12.1/homebrew.mxcl.postgresql.plist /Library/LaunchAgents/ 目录下

 

4、执行  launchctl load /Library/LaunchAgents/homebrew.mxcl.postgresql.plist 

 

5、重启电脑,查看postgres 进程
ps -ef |grep postgres 

 

mac 很多brew 安装服务都可以通过这种方式进行开机自启动,Cellry下找到 这个服务的plist文件,链接到 /Library/LaunchAgents/ 目录下,然后执行第4步的命令

如果不是brew安装的服务也可以通过这种方式进行开机自启,不过要手动编辑 .plist 这个文件,具体怎么编辑网上有很多资料

posted @ 2019-12-24 15:41  wygbbb  阅读(1346)  评论(0编辑  收藏  举报