Sunday, May 13, 2012

Rails3, upgrading to OS X Lion and Postgres failing to connect afterwords

I like my post subjects long.  :)

I recently upgraded my computer to Lion from Snow Leopard and after doing this I fired up the rails server to get some work done and everything looked like it was working, nice! Then I tried to load a page from the server and it failed to connect to postgres sql server, not so nice.

This post http://bradleyayers.blogspot.com.au/2011/07/repairing-postgresql-after-upgrading-to.html covers most of what was wrong.

The trouble was before I got to that post I had tried un-installing the pg gem (gem uninstall pg I believe is what I chose and then picked all versions).

One quick not on the link above, make sure you change 9.0 to 9.1 in the paths (or whatever version you're on), I did a quick copy and paste and it found the executable but not the data and I was tired and didn't realize what was going on for a moment.

SO.  Getting back to the problem I created for myself, I had no pg gem and gem install pg now fails.  Why? I had XCode installed but it turns out my dev tools (or paths to them) were wiped out in the upgrade.

The quick answer? Open the "App Store", search for XCode and install the latest version (it's free).  Then I went ahead and installed the command line development tools and restarted terminal before trying anything else ala this post http://stackoverflow.com/questions/10344821/gem-install-pg-doesnt-work-on-osx-lion

Problem solved and I'm back on my way to railsy postgressiveness.

Or something like that.  Hope this helps someone or something!

No comments:

Post a Comment