Wasted an hour on this (when PostgreSQL psql doesn't work)
I installed postgres with brew, but when I run psql, it says command not found. Turns out I hadn't added the psql path to PATH. Don't go through the same hassle I did.
Solution: 'export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"'
9 answers
Agreed, I also wasted 30 minutes on that at first lol
Well, that's a bit... these days when you install postgresql via brew, doesn't it usually handle the path? It just worked for me.
An hour of messing around is nothing—this is exactly why I switched Postgres over to Docker lol
Oh, I didn't know that. I gave up last time because psql wasn't working.
Got a source? The path can differ by version, so postgresql@15 users should be careful.
True haha, the catch is that installing brew doesn't automatically set the PATH.
I feel the same way. But if you add export PATH to ~/.zshrc, it applies permanently, so I'd recommend that.
Actually, this only applies to Mac, so Windows users are not affected. Still, thanks for the info.
Wait, no, wouldn't it be cleaner to just do brew link --force --overwrite postgresql@16 instead of this? If you add export PATH, you'd have to do it every time you open the terminal.