Hello December. Didn’t see ya there. Please don’t sneak up on me again.
Installing PostgreSQL on my Mac
[caption id=”” align=”alignright” width=”64” caption=”PostgreSQL”][/caption] 1. Download postgres for Mac
- 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 PATH=$PATH:/Library/PostgreSQL/9.0/bin
export PGDATA=/Library/PostgreSQL/9.0/data
4. Execute the profile
$ . ~/.bashrc
5. Modify Postgres to use “trust” authentication, so we don’t need to supply a password when connecting to the database.
$ sudo vi /Library/PostgreSQL/9.0/data/pg_hba.conf
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
$ sudo su - postgres
$ . ./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:
$gem install pg
$ 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!