Installing RubyGems as non-root user on MacOS X

I'm trying to install RubyGems on MacOS 10.3.9 in my home directory as a non-root/non-admin user. I have Ruby 1.8.2 installed via DarwinPorts and Ruby 1.8.2 is in my PATH ahead of the system ruby.

I am installing RubyGems 0.8.10 from source (not using DarwinPorts) as follows.

   $ ruby setup.rb config --prefix=/Users/jose/
   $ ruby setup.rb setup
   $ ruby setup.rb install

taken from the RubyGems manual[1]. The first two commands complete without error but the final command fails with the following:

hook /Users/jose/Projects/Ruby/rubygems-0.8.10/./post-install.rb failed:
You don't have write permissions into the /opt/local/lib/ruby/gems/1.8 directory.
Try 'ruby setup.rb --help' for detailed usage.

I've googled a bit for this but so far have not found any fixes. How do I stop rubygems from trying to modify my main ruby setup. I would like Rubygems to be contained entirely within my home directory. Is that possible? Do I need to build my own private copy of Ruby as well?

Many thanks for and advice.

[1]: http://docs.rubygems.org/read/chapter/3#page70

···

--
Jose Marques

That did the trick. Only downside seems to be that readline support doesn't work in irb but that's not a big problem.

···

On Thu, 21 Apr 2005, Jose Marques wrote:

Do I need to build my own private copy of Ruby as well?

--
Jose Marques

Jose Marques wrote:

···

On Thu, 21 Apr 2005, Jose Marques wrote:

Do I need to build my own private copy of Ruby as well?

That did the trick. Only downside seems to be that readline support doesn't work in irb but that's not a big problem.

Yeah, I can't get readline support to work in irb on my Mac either. If anyone knows please let us know....

Zach

This may not be the best way but I used the following script to build my private copy of ruby _with_ readline support. Looking at the log file in the readline ext directory it seems it wasn't picking up my LDFLAGS settings. The readline library was already installed in /opt/local using DarwinPorts.

-8<- cut here ----
#!/bin/sh

PREFIX=${HOME}/tools
export PREFIX

LDFLAGS="-L${PREFIX}/lib -L/opt/local/lib"
export LDFLAGS
# For readline support
DLDFLAGS=${LDFLAGS}
export DLDFLAGS

CFLAGS="-I${PREFIX}/include -I/opt/local/include"
export CFLAGS

VERSION=1.8.2

cd ruby-${VERSION}
../configure --prefix=${PREFIX}
make
make install

···

On Thu, 21 Apr 2005, Zach Dennis wrote:

Yeah, I can't get readline support to work in irb on my Mac either. If
anyone knows please let us know....

--
Jose Marques