If you're trying to install RMagick on Ubuntu Gusty, you won't have much luck, as the new RMagick doesn't support the version of ImageMagick that Gusty currently has.
To install RMagick on Gusty, run:
sudo apt-get remove librmagick-ruby librmagick-ruby1.8 librmagick-ruby-doc sudo apt-get install libmagick9-dev sudo gem install rmagick -v 1.15.12
These commands assume you have Ruby and RubyGems installed already.
These instructions also work for Debian 4.

