Peter Mellett

Stylised cartoon of me with glasses on.
Articles tagged with 'rails'.

Installing pg Gem on OS X Lion

After spending a frantic 20 minutes trying to find a way to install the pg gem on OS X Lion, I discovered this solution.

I had installed Postgres through homebrew and the instructions were not clear on where the pg_config file was installed. brew info postgresql recommends ensuring you set the correct architecture in an environment variable to build the x64 version with ARCHFLAGS='-arch x86_64' gem install pg which didn't work in my case.

Suggested elsewhere was to specify the pg_config file location to the postgres gem, but no mention of where this file may be found. After a not-so-quick search (the ridiculous find / pg_config | grep pg_config) I found it at /usr/local/bin/pg_config the file will be elsewhere if you installed from source.

Before you bundle install - to a terminal full of make errors - install the pg gem with:

1 gem install pg -- --with-pg-config=/usr/local/bin/pg_config

You may need to run sudo gem install [...] if you are not using a version manager like RVM or Rbenv.

Headache averted.

New Additions

I've recently added a place to highlight my current and past projects. A project will also be highlighted on the right-hand side of the page, picked at random.

The first of these projects to be added is my first Rails project (which is not my first project to production; you're reading this post on it) R3TMS. It is a project I have developed on an informal basis to replace an existing piece of software in use at work.

So far, learning Rails has been a fun-filled process (in the Dwarf Fortress sense) with two major Rails versions since I started learning (3.1 had just been released when I picked up my first book but, unfortunately, my copy was for 3.0) which caused some head-scratching and a lot of post-it notes with advice for future me.

I will be adding more of my projects as and when I can but working on them is more fun than writing about them, as the space between posts here shows.

Cheers.