WebFaction
Community site: login faq

I want to install a gem locally (not as part of a rails app though) but it requires a higher version of rubygems.
gem update --system doesn't work though since it tries to use the system ruby.

$ gem update --system   
Updating RubyGems  
Updating rubygems-update  
Successfully installed rubygems-update-1.4.2  
:0:Warning: Gem::SourceIndex#search support for String patterns is deprecated  
Updating RubyGems to 1.4.2  
Installing RubyGems 1.4.2  
ERROR:  While executing gem ... (Errno::EACCES)  
    Permission denied - /usr/local/lib/ruby/site_ruby/1.8/rbconfig/datadir.rb

However this added:/home/username/gems/gems/rubygems-update-1.4.2/

I added this in my .bash_profile:

export GEM_HOME=$PWD/gems  
export PATH="$PWD/bin:$PATH"

(logged out/in) and ran

$ which gem  
~/bin/gem  
$ gem -v  
1.3.1

This makes me think it's using the gem command in my local folder. gem update -system still doesn't work but using the folder it downloaded above:

$ gem install rubygems-update
Successfully installed rubygems-update-1.4.2
1 gem installed
Installing ri documentation for rubygems-update-1.4.2...
Installing RDoc documentation for rubygems-update-1.4.2...

But it still says it's version 1.3.1. Where is it installing 1.4.2? Am I even close?

asked 26 Jan '11, 22:14

joeminkie
11112
accept rate: 0%


So, after searching around some more, I found this: http://forum.webfaction.com/viewtopic.php?id=4918 and installed my own ruby version. Then I tried to install rubygems but got this error:

require': no such file to load -- rubygems (LoadError)

Eventually I found this: http://docs.rubygems.org/read/chapter/19#page98 and copied the following files from ~/lib to ~/ruby/lib/ruby/site_ruby/1.8

gauntlet_rubygems.rb
rubyconfig/
rubygems/
rubygems.rb
ubygems.rb

Everything seems to be working for now...

permanent link

answered 27 Jan '11, 20:13

joeminkie
11112
accept rate: 0%

Glad to hear you were able to figure it out.

(27 Jan '11, 20:17) johns

Here's how we recommend installing RubyGems locally. This assumes that your Passenger-based Rails app is named "rails" and that your username is "your_username":

In a SSH session, run the following commands:

cd ~/webapps/rails
export GEM_HOME=$PWD/gems
export PATH=$PWD/bin:$PATH
export RUBYLIB=$PWD/lib:$RUBYLIB
mkdir src
cd src
wget http://production.cf.rubygems.org/rubygems/rubygems-1.5.2.tgz
tar zxf rubygems-1.5.2.tgz
cd rubygems-1.5.2
ruby setup.rb install --prefix=$HOME/webapps/rails

Then, edit ~/webapps/rails/nginx/conf/nginx.conf to add this line to the beginning of the file:

env               RUBYLIB=/home/your_username/webapps/rails/lib;

Then, edit ~/webapps/rails/bin/start to add the RUBYLIB environment variable to the start command, eg:

RUBYLIB=/home/your_username/webapps/rails/lib TMPDIR=/home/your_username/webapps/rails/tmp GEM_HOME=/home/your_username/webapps/rails/gems /home/your_username/webapps/rails/nginx/sbin/nginx -p /home/your_username/webapps/rails/nginx/

Finally, restart your Nginx:

~/webapps/rails/bin/restart

That's it, you're done :)

permanent link
This answer is marked "community wiki".

answered 25 Feb '11, 19:45

seanf
12.2k41836
accept rate: 37%

edited 25 Feb '11, 19:50

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×102
×81
×11

question asked: 26 Jan '11, 22:14

question was seen: 12,008 times

last updated: 25 Feb '11, 19:50

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM