まずは素直にインストール。
brew search postgres
brew install postgresql
終わったら画面の指示通りに。
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
ここでパスワードを設定。
psql postgres
postgres=# \password
postgres=# \q
次にエディターで以下のファイルを編集する。
sudo vim /usr/local/var/postgres/pg_hba.conf
trust
になっているところを全部 md5
に書き換え。
保存したら、postgresを一旦停止して、
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
また起動。
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist