Remove any previous version:
brew rm postgresql --force
Installation
brew update
brew install postgresql
Initialise a database.
initdb /usr/local/var/postgres
Set to start at login with (in one line below)
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/[x.x.x]/[....].postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
OR
Add aliases to .bashrc to start and stop the server:
alias pgs='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start'
alias pgq='pg_ctl -D /usr/local/var/postgres stop -s -m fast'
Postgresql client verification:
$which psql
$ls -al /usr/local/bin/psql
/usr/local/bin/psql -> ../Cellar/postgresql/.../bin/psql
(Edit ~/.bash_profile : PATH=/usr/local/bin:$PATH)
Update postgresql tools versions
Tools like psql or pg_dump may not be update by the installations.
Just remove old version pg_* in /usr/bin, and create symbolic link to new ones in /usr/local/bin.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.