安装homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装postgreSQL
brew install postgresql
查看版本
postgres --version
初始化
initdb /usr/local/var/postgres
启动服务器
postgres -D /usr/local/var/postgres
创建用户
createuser -a -d username -P
取消用户
dropuser username
创建数据库
psql -U postgres
> create database mydb;
开机启动
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist