[Mac-PostgreSQL] Homebrew 이용해 PostgreSQL 설치 및 삭제
1. Homebrew 이용해 PostgreSQL 설치하기
Terminal 에서
#homebrew 업데이트
brew update
#PostgreSQL 설치
brew install postgresql
#PostgreSQL 서비스 시작
pg_ctl -D /usr/local/var/postgres start && brew services start postgresql
#서비스 실행 확인
postgres -V
psql (13.0)
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
maron | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
postgres=# quit
#PostgreSQL 접속
psql postgres
2. PostgreSQL 삭제하기
Terminal 에서
#PostgreSQL 삭제(uninstall)
sudo /Library/PostgreSQL/10/uninstall-postgresql.app/Contents/MacOS/uninstall-postgresql
#PostgreSQL user 제거
System Preference > userse & Groups > Unlock > remove postgresql user by clicking "-"
#databases 삭제
rm -rf /usr/local/var/postgres/*