Installing PostgreSQL on my Mac
November 30th, 2010 by Brian | Filed under work.
PostgreSQL
- Don’t sign up for enterprise db crap, the download will start in a sec
2. Install postgres
- This may require reboot to set some syscontrol settings (it did for me)
- I created the “postgres” user with “postgres” as the password (so I could remember it)
3. Add stuff to your ~/.bash_profile
export PGDATA=/Library/PostgreSQL/9.0/data
4. Execute the profile
5. Modify Postgres to use “trust” authentication, so we don’t need to supply a password when connecting to the database.
5.1 For each entry, change METHOD “md5″ to “trust” (this should only be done on your developer machine!)
6. Restart postgres to pick up the conf changes
$ . ./pg_env.sh
$ pg_ctl restart
7. Beer time!
All of the above was done solely so I could run some ActiveRecord tests, so here’s how we do that:
$ git clone git://github.com/rails/rails.git
$ cd rails/activerecord
$ rake postgresql:build_databases
$ rake test_postgresql TEST=test/cases/base_test.rb
(in /Users/brian/dev/ruby/rails/activerecord)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -w -I"lib:test:test/connections/native_postgresql" "/Users/brian/.gem/ruby/1.8/gems/rake0.8.7/lib/rake/rake_test_loader.rb" "test/cases/base_test.rb"
Using native PostgreSQL
Loaded suite /Users/brian/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
…………………………………………………………………………………………………………………..
Finished in 3.321415 seconds.
131 tests, 336 assertions, 0 failures, 0 errors
SUCCESS!


Great article.
You forgot to give us the password for your mac.