Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How To Avoid The Ubygems Load Error

DZone's Guide to

How To Avoid The Ubygems Load Error

·
Free Resource
If you install Ruby & RubyGems from scratch (like described here or here), beginning with:


sudo mv /usr/local/lib/ruby ~/Desktop


and at some point have to execute the command:


sudo /usr/local/bin/ruby setup.rb


... you may see an error message that says:


/usr/local/bin/ruby: no such file to load -- ubygems (LoadError)


This can be avoided by setting the RUBYLIB path variable to include the lib directory of the downloaded RubyGems version:


unset RUBYOPT
export GEM_HOME=/usr/local/lib/ruby/gems/1.8
export RUBYLIB=/usr/local/lib/ruby:/path/to/download/dir/rubygems-1.3.1/lib

sudo /usr/local/bin/ruby setup.rb


or


sudo mkdir -p /usr/local/lib/ruby/gems/1.8
sudo mkdir -p /usr/local/lib/ruby/site_ruby/1.8
unset RUBYOPT
export GEM_HOME=/usr/local/lib/ruby/gems/1.8
export RUBYLIB=/usr/local/lib/ruby:/usr/local/lib/ruby/site_ruby/1.8
sudo cp -R -p /path/to/download/dir/rubygems-1.3.1/lib/* /usr/local/lib/ruby/site_ruby/1.8

sudo /usr/local/bin/ruby setup.rb

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}