I was trying to install gem in my home directory on the server where my site is to be hosted and read up on it in the RubyGems Manual. The system is a FreeBSD7 system running on Intel iron. So far, some things worked differently than described so I though I'd put them here for posterity:
- First I created a directory for the gems and the gem program to reside: ~/lib/ruby (I already had a ~/lib/perl for perly stuff.)
- Then I added the line "setenv GEM_HOME $HOME/lib/ruby/gems" to my .cshrc
- Dont forget to "source .cshrc"
- I unpacked the rubygem package in some directory
- Next, after going into that directory, did 'ruby setup.rb config --prefix=~/lib/ruby'. (Note the lack of the trailing 'gems' directory.)
- So far so good. This was more or less what the manual described. However, I had to modify the setup command to: 'ruby setup.rb setup --prefix=~/lib/ruby'. In the manual, the --prefix parameter was not there.
- The same thing for the actual installation: 'ruby setup.rb install --prefix=~/lib/ruby'.
- Next, ruby needed to find the gem libraries, so this line, "setenv RUBYLIB $HOME/lib/ruby/lib"
- I checked the setup using "gem environment" but got an error in rubygems.rb apparently because the user_paths method was getting a string instead of an array. I fixed it by changing the use_paths method to read:
def self.use_paths(home, paths=)
set_home(home) if home
if paths.is_a? String
set_paths(paths.join(File::PATH_SEPARATOR)) if paths
- Now "gem environment" seems to work. I'm not sure what the cause of this is and I'll leave it for the moment.
- I tried to install rails via "gem install rails" ... and it worked! Apparently. Note the lack of the "sudo" before that line. This is all in my local directory on the server.