Common Errors When Installing postgres SQL and Ruby on Rails

I was setting up my local development environment for Podcastinople on my new Vista install and ran into some problems that I was able to find hidden deep in Ruby and Postgres forums and list archives.

One problem I had was that when I was creating some of my local postgres databases using a normal windows command prompt, this would cause it to spit out: psql: FATAL: password authentication failed for user ‘Rob’. ‘Rob’ is the name of my Windows Vista username, and shouldn’t have been a part of any postgres SQL operation, so I was confused.

Then I realized that I needed to be running psql to ‘postgres’ which is an installed shortcut with postgres.

The next problem I ran into was that postgres was reporting that I already had users in my database, specifically the default user: ‘postgres.’ The problem is that I had performed a full uninstall using the Control Panel, so I figured that the users should have been cleared out, they weren’t.

Vista did not report these users, but I was able to view them using the “net user” command from the Windows shell. Specifically, I used “net user postgres /delete”. I’m not sure how you are supposed to view users from this net command in Vista. I got this answer from this forum thread.
Another problem was that postgres was saying:

If you have an existing database with the same major version number, you do not need to initialise a database cluster.
If you have an existing database with a different major version number you need to backup your old database and create a new one.

The answer to this one was that you need to delete c:program filespostgresql8.xdata folder before you reinstall. (Or during. If you delete the folder and then click next on the setup dialog box it will go through.) The answer to this one was here.
Yet another gotcha came from trying to rake, which caused me to get a “No such file to load — postgres” error. The suggested solution to this was to make sure that the PostgreSQL bindings were installed using “gem install postgres”. This didn’t work–I actually had these installed already. The actual answer was to install the pure Ruby interface to PostgreSQL using “gem install postgres-pr”. The answer to that was found here.

Another problem is that my rake.bat file was using a require_gem command which is deprecated. It was shooting a warning: “require_gem is obsolete. Use gem instead” The solution to this was to go into the rake.bat and change the require_gem command to just gem. That answer was here.

Next in line for problems was that imagemagick was causing a big ugly error during the course of the rake, specifically: “This application has failed to start because CORE_RL_magick_.dll was not found. Re-installing the application may fix this problem.” The answer to this was to check and make sure that the imagemagick folder was in my system path. That answer is here.

Finally, I got an error that my imagemagick and rmagick versions were incompatible. It turns out that rmagick packages a .msi installation with imagemagick, and that you need to install that version. Not the latest on the imagemagick website. So, be sure to do that.

What does all this show? Installing a development environment for Ruby and PostgreSQL with Imagemagick can be a painful experience. Especially if you botch the installation once. You don’t want to do that.

Anyway, you either found this using a search engine and it was exactly what you were looking for or this was a totally nonsensical post to you. Good luck with postgres/RoR!

3 thoughts on “Common Errors When Installing postgres SQL and Ruby on Rails”

  1. I hate it when my imagemagick and rmagick versions are incompatible. Simply inexcusable if you ask me, which you should have.

Leave a Reply

Your email address will not be published. Required fields are marked *