Everything was working, but today I get this error:
Could not find gem 'cgi (>= 0) ruby' in the gems available on this machine.
I have ruby1.9.1-dev installed.
It sounds like you're trying to install the "cgi" gem. It ships with Ruby, so there's no need for that step. Just "require"-ing it should be sufficient.