The default PostgreSQL installation for MacOS is via installer packaged by EDB, provides more features and easier for beginners. Personally I prefer to have PostgreSQL installed in specified folders, easier to manage multiple versions co-exists on my laptop and easier to uninstall and upgrade.
- Download PostgreSQL binaries archive.
- Unzip them to a folder. Here it will unzip into
/Users/donghua/Tools/pgsql
unzip postgresql-16.3-1-osx-binaries.zip -d /Users/donghua/Tools
- Fix com.apple.quarantine issue on MacOS
sudo xattr -dr com.apple.quarantine $i /Users/donghua/Tools/pgsql
for i in `find /Users/donghua/Tools/pgsql/bin -type f`
do
ls -l@ $i|grep com.apple.quarantine > /dev/null
if [[ $? -eq 0 ]] then
print "File quarantine: $i"
sudo xattr -d com.apple.quarantine $i
fi
done
for i in `find /Users/donghua/Tools/pgsql/lib -type f`
do
ls -l@ $i|grep com.apple.quarantine > /dev/null
if [[ $? -eq 0 ]] then
print "File quarantine: $i"
sudo xattr -d com.apple.quarantine $i
fi
done
- Setup your environment variables.
Here I use zsh
, put below entries to ~/.zprofile
export PGHOME=/Users/donghua/Tools/pgsql export PGDATA=/Users/donghua/Tools/pgdata/16/data
export PATH=$PATH:$PGHOME/bin
alias pgadmin4="open -a '/Users/donghua/Tools/pgsql/pgAdmin 4.app'" alias pglog='cd $PGDATA/log/;ls -1t | head -n 1 | xargs tail -f'
No comments:
Post a Comment