First, verify which PostgreSQL versions are installed:
brew list | grep postgresqlThen, check the location of pg_restore:
which pg_restoreAnd confirm the version it is using:
pg_restore --versionIf it's still showing PostgreSQL 14, it means your system is not using the newly installed PostgreSQL version.
Find out the installed PostgreSQL versions via:
brew info postgresqlIf you recently upgraded, you might have a newer version installed but not linked.
Run:
brew link postgresqlIf you see an error about conflicting files, force the link:
brew link --overwrite postgresqlThen, restart your terminal and check pg_restore --version again.
Homebrew installs newer PostgreSQL versions under /opt/homebrew/bin (for Apple Silicon) or /usr/local/bin (for Intel Macs).
List the available versions:
ls /opt/homebrew/Cellar/postgresql/(or for Intel Macs)
ls /usr/local/Cellar/postgresql/If a newer version (e.g., 16.x) is installed, but pg_restore is still using an older one, run:
/opt/homebrew/Cellar/postgresql/16.2/bin/pg_restore --version(or)
/usr/local/Cellar/postgresql/16.2/bin/pg_restore --versionIf this shows the correct version, update your PATH:
echo 'export PATH="/opt/homebrew/Cellar/postgresql/16.2/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcOr for Intel Macs:
echo 'export PATH="/usr/local/Cellar/postgresql/16.2/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcNow, check pg_restore --version again.
If Homebrew isn’t working as expected, manually install PostgreSQL 16:
brew install postgresql@16
brew link postgresql@16 --forceThen check:
pg_restore --versionIf you've installed PostgreSQL 16 but it's not active, restart the service:
brew services restart postgresqlThen, verify again:
pg_restore --versionOnce pg_restore shows PostgreSQL 16.x, try running your restore command again.
Let me know if you need more help! 🚀