One of the other errors I see frequently during ruby install is:
An error occured while installing rmagick (2.13.1), and Bundler cannot continue. Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.
The issue can be solved easily.
apt-get install libmagick++-dev libmagickcore-dev libmagickwand-dev
It will install alot of dependent packages, but all required headers will be present. In my opinion magick is a little to resource heavy, and should be a little less hungry.