I bought a couple of Ruby on Rails books hoping to learn my way around the development platform but have been pretty confused with getting the environment set up. I get by so much on pages like this when I’m troubleshooting I figured I’d put this up to help anyone else in the same boat as me. Even though a lot of this information exists in other places in different contexts, my situation seemed common enough to warrant making my own rundown. Command line code snippets have been abbreviated and condensed, but should be enough to see what’s going on.
On page 24 of ‘Agile Web Development with Rails’ they give you a tip to ‘fix’ the Apple default configuration of Ruby which produced the following error:
sudo gem install fixrbconfig sudo fixrbconfig ==================== /usr/lib/ruby/1.8/powerpc-darwin8.0/ruby.h does not exist. This probably means you haven't yet installed Xcode from the Tiger DVD. You won't be able to compile Ruby extensions without it. Please install it then rerun this program.
I had just previously installed Xcode, so I knew that wasn’t it. I decided to run a search for the ‘ruby.h’ file in case it really was there, just in a different place, and it turned out it was:
cd / find . -name "ruby.h" -print ./usr/lib/ruby/1.8/universal-darwin8.0/ruby.h
This searched through my entire hard drive, so it took a little while returning the odd ‘Permission denied’ error along the way, but eventually it did turn up, so I copied it to where fixrbconfig was expecting it to be, reran fixrbconfig and it all seemed to work out fine.
sudo cp /usr/lib/ruby/1.8/universal-darwin8.0/ruby.h /usr/lib/ruby/1.8/powerpc-darwin8.0/ruby.h sudo fixrbconfig