1 min read

Installing pg gem with Postgres.app

PostgreSQL? I love it. It is easy to work with, plays awesomely nice with Ruby on Rails and comes as a hassle-free add-on on the Heroku platform.

Installing PostgreSQL on a Mac though? Not so much. Even installing PostgreSQL on a Mac with Homebrew and then starting/stopping takes a little effort. And then you have to go run some more terminal comments and run it automatically, etc. Don’t get me wrong, I actually like using the command line (actually using the Total Terminal app which I really like) but I am not geek enough to have to do everything inside the terminal app.

So I have been using the Postgres.app almost for the past two years. The app is described as “the easiest way to get started with PostgreSQL on the Mac.”

And it sure delivers on that promise.

Since it is so convenient to install and then set it to run automatically after system startup that I almost forget it is installed on my Mac. Hence every time I need to install the pg gem from scratch for whatever the reason, I have to remember how to do it with the Postgres.app.

Such was the case when I realized that OS X Mavericks somehow messed up my rbenv. And the only solution was — you guessed it right — going through the fun process of uninstalling rbenv and reinstalling it. So here is the command to install the pg gem with the Postgres.app for anyone who needs it (and for my future self I am sure):gem install pg — — with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config