You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.
Go to Postgre Download Site
/Gemfile
gem 'pg'
-
Edit postgre configuration file:
sudo nano /Library/PostgreSQL/9.3/data/pg_hba.conf
-
Change all configuration access to:
# TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust
-
Restart postgre server
sudo su - postgres cd /bin ./pg_ctl -D /Library/PostgreSQL/9.3/data stop ./pg_ctl -D /Library/PostgreSQL/9.3/data start
-
Set your database.yml Rails file:
development: adapter: postgresql username: postgres database: DATABASE_NAME_development host: localhost pool: 5 encoding: unicode test: adapter: postgresql username: postgres host: localhost database: DATABASE_NAME_test pool: 5 encoding: unicode
-
Enjoy :)
I installed Lunchy for finding homebrew's postgresql
Check it here:
http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/