Installing gems for a single user

I’m used to using gems locally where I can install them systemwide. But
in a shared hosting environment, where there might be several systemwide
gems installed by the host, there may be gems I want to install just in
my home directory. Does RubyGems support this? In a way that your Ruby
program can access both the systemwide and local gems?

Thanks!

Jen

On Fri, Jul 14, 2006 at 12:43:03AM +0900, jennyw wrote:

I’m used to using gems locally where I can install them systemwide. But
in a shared hosting environment, where there might be several systemwide
gems installed by the host, there may be gems I want to install just in
my home directory. Does RubyGems support this? In a way that your Ruby
program can access both the systemwide and local gems?

Sure:

mkdir ~/.gems
export GEM_HOME=/home/jennyw/.gems
wget http://code.whytheluckystiff.net/sources/rubyforge-0.0.1.gem
gem install rubyforge-0.0.1.gem

And you should be able to gem list, gem install, etc.

In scripts where you don’t have control over the environment and
RubyGems is
already loaded, use:

Gem.use_paths("/home/jennyw/.gems")

For other concrete examples, you might scan:
http://balloon.hobix.com/lib/balloon.rb

_why

jennyw wrote:

I’m used to using gems locally where I can install them systemwide. But
in a shared hosting environment, where there might be several systemwide
gems installed by the host, there may be gems I want to install just in
my home directory. Does RubyGems support this? In a way that your Ruby
program can access both the systemwide and local gems?

My solution: compile and install Ruby in ~/software (or similar) and
use that Ruby for everything, including gems. No permission
problems.

Gavin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs