I thought I had the whole thing working when I got rake and rails to install via rubygems but then when I hit the mysql gem and alternately the ruby-mysql gem, I got stuck with errors like:
For mysql gem:
ERROR: Error installing mysql:
mysql requires Ruby version >= 1.8.6.
For ruby-mysql gem
ERROR: Error installing ruby-mysql:
ruby-mysql requires Ruby version >= 1.8.7.
This was weird, since I had installed 1.8.7p249 and sourced my script to set the environment for it.
Running gem env showed me rubygems even though it had my custom ruby in its shebang line for the gem command was actually using the old 1.8.5 system install, which at least explained why the errors cropped up complaining about version. Another symptom of having rubygems 1.3.6 installed by the later version of ruby running under the 1.8.5 it defaulted to was that 'gem help' worked but 'gem help
Googling around the net, I found a few postings from people in analogous situations who advocated removing the old installation of ruby. Not an option for us, so I dug deeper into the docs for rubygems and the code. Eventually this led me to the $RUBYLIB environment variable. My script had it set to $PREFIX/lib, where setup.rb had put the rubygems files. So it was missing access to some of the other parts that should have been in RUBYLIB.
This is the part of the environment setup file I source now to use the new ruby that fixed the problem. It first has the two standard directories for ruby files, then the directory Rubygems installed into:
Using it, 'gem env' reports the correct ruby in use, ruby-mysql installs, and 'gem help install' works.