Installing RubyGems as non-root user on MacOS X

J

Jose Marques

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
 
J

Jose Marques

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.
 
Z

Zach Dennis

Jose said:
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
 
J

Jose Marques

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top