how to install postgres on Mac

安装Postgres

1) This is the easiest part, simply

$ brew install postgres

2) this step is not obvious but you can’t move on without it (would be nice if brew can automate this step too :D)

$ initdb /usr/local/var/postgres

启动server

pg_ctl -D /user/local/var/postgres start

创建DB

createdb mydb

进入DB

psql mydb user_name (username 是在init 那步的是会提示,一般就是当前机器的登陆用户名)

Articles