DataBase/postgresql

[Mac OS] postgresql 설치

코드몬스터 2024. 4. 8. 13:53
728x90

 

Homebrew 사용해서 설치 

1. 설치 명령어

  • 다른 버전 설치하고 싶으면 12를 13, 14 등으로 변경하면 됨.
  • @12 를 빼서 명려어를 실행하는 경우, 최신 버전이 설치 될 것으로 생각.
brew install postgresql@12

 

2. 버전 확인

psql --version

psql -V

 

3. postgresql 서비스 실행

brew services start postgresql@12

 

4. postgresql 접속

psql postgres

 

 

5. psql 명령어가 없다는 에러 발생

예) zsh: command not found: psql

export PATH="/opt/homebrew/opt/postgresql@12/bin:$PATH" >> ~/.zshrc

 

 

참고 사이트