Skip to content

Instantly share code, notes, and snippets.

@Rafe
Created March 22, 2012 20:48
Show Gist options
  • Save Rafe/2164194 to your computer and use it in GitHub Desktop.
Save Rafe/2164194 to your computer and use it in GitHub Desktop.
postgresql install
# Start/Stop PostgreSQL
If this is your first install, automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
If this is an upgrade and you already have the homebrew.mxcl.postgresql.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
cp /usr/local/Cellar/postgresql/9.1.3/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
Postgresql:
brew install postgresql
#1 need install uuid-ossp
#check uuid-ossp installed and writable (chmod to user writable)
brew install ossp-uuid
brew unlink ossp-uuid && brew link ossp-uuid
#2 on lion, mac default with postgre installed, execute the script to link the bin
# to new installed one.
#http://nextmarvel.net/blog/2011/09/brew-install-postgresql-on-os-x-lion/
curl http://nextmarvel.net/blog/downloads/fixBrewLionPostgres.sh | sh
#init db file position
initdb /usr/local/var/postgres
#createuser:
createuser [options] [user]
createdb [name]
#start
pg_ctl -D /usr/local/var/postgres -l logfile start
#stop
pg_ctl -D /usr/local/var/postgres stop -s -m fast
#change database.yml in rails or init app by rails new [appname] -d postgresql
development:
adapter: postgresql
encoding: utf8
database: masxaro_development
username: masxaro
password:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment