2 Answers
2

The entire Rails environment is loaded when executing a Rake task such as performing a database migration and that includes gem dependencies. I got bitten by the same thing recently when resurrecting an old project and I couldn't migrate the database until I'd installed certain unrelated gems.

From looking at the information in the stack trace (Library not loaded: /usr/local/libpng/lib/libpng12.0.dylib) I would suspect that ImageMagick is not installed correctly on your machine. You might want to give this script a try.

Doesn't the entire Rails environment get loaded when the application runs as well? It runs without problems, but it dies on rake db:migrate. Work-around : disable references to rmagick in environment.rb while migrating…
–
Dan DonaldsonSep 24 '10 at 21:55