I was having issues installing PostgresQL on MacOS on my personal laptop which runs on an Apple M1 chip. I use ZSH.
I tried installing using Homebrew before, but that didn’t provide the desired result. After trying to use Homebrew, commands like psql
and pg_dump
would not work.
Install PostgresQL on Mac using Postgres.app
- Go to https://postgresapp.com/
- Download and install the version you want
- Run the application and click “initalize” or “start”
- Stop any existing PostgresQL processes (optional step if you get a warning)
- Add the application to your PATH. For ZSH: add this to your ~/.zshrc file:
export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:${PATH}"
- Run
source ~/.zshrc
in your terminal or the equivalent for your shell. Or just restart your terminal application.
It’s not super difficult to install PostgresQL, but hopefully this will save you some time searching the internet wondering why your PostgresQL commands weren’t working.