Homebrewを使用してインストール
brew install postgresql
2019年2月時点では、PostgreSQL 11がインストールされる。
出力
==> Downloading https://homebrew.bintray.com/bottles/postgresql-11.1_1.mojave.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring postgresql-11.1_1.mojave.bottle.1.tar.gz
==> /usr/local/Cellar/postgresql/11.1_1/bin/initdb /usr/local/var/postgres
==> Caveats
To migrate existing data from a previous major version of PostgreSQL run:
brew postgresql-upgrade-database
To have launchd start postgresql now and restart at login:
brew services start postgresql
Or, if you don't want/need a background service you can just run:
pg_ctl -D /usr/local/var/postgres start
==> Summary
🍺 /usr/local/Cellar/postgresql/11.1_1: 3,548 files, 40.3MB
起動
brew services コマンドを使用して起動する。
brew services start postgresql
停止
brew services stop postgresql