以下所有命令在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 這個文件,具體怎么編輯網上有很多資料
