0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Homebrewで、PostgreSQLをダウンロードした時に、psqlで反応しない時に反応させるための方法

0
Last updated at Posted at 2025-09-05

解決策

パスを通そう!!!!

PostgreSQL 17 を Homebrew で入れたのに psql が使えないときって、
だいたい パス設定がちゃんとできてないか古いバージョンが優先されているのが原因!!

今回の場合だと、パスが通っていませんでした!!

インストール直後だと、psql の場所が環境変数 PATH に含まれてないことが多い。
なので、Zsh 使ってるならターミナルでこれを実行してみて👇

echo 'export PATH="/opt/homebrew/opt/postgresql@17/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

これで設定が反映されるから、試しに

psql --version

って打って、17.x って出ればOK!

コマンド一発で、PostgreSQL17とpgadminを使えるようにする

brew install pgadmin4
brew install postgresql@17
echo 'export PATH="/opt/homebrew/opt/postgresql@17/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

PostgreSQL 操作コマンド対応表

操作 Windows コマンド macOS (EnterpriseDB 版) コマンド
ステータス確認 sc query postgresql sudo -u postgres /Library/PostgreSQL/17/bin/pg_ctl -D /Library/PostgreSQL/17/data status
起動 net start postgresql sudo -u postgres /Library/PostgreSQL/17/bin/pg_ctl -D /Library/PostgreSQL/17/data start
停止 net stop postgresql sudo -u postgres /Library/PostgreSQL/17/bin/pg_ctl -D /Library/PostgreSQL/17/data stop -m fast
再起動 net stop postgresqlnet start postgresql sudo -u postgres /Library/PostgreSQL/17/bin/pg_ctl -D /Library/PostgreSQL/17/data restart
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?