I needed to upgrade to the latest version,
so I downloaded Ruby 1.8.5 source from:
http://www2.ruby-lang.org/en/20020102.html
which I installed in:
/usr/local/bin/rub
Now RubyGems and the libraries I had installed are not found.
I can run ruby with this alias:
ruby='/usr/local/bin/ruby'
Is there a way to get RubyGems and the libraries to be
recognized by this new version? Or a way to install them
into the new version?
-Doug
> so I downloaded Ruby 1.8.5 source from:
> http://www2.ruby-lang.org/en/20020102.html
> which I installed in:
> /usr/local/bin/rub
> Now RubyGems and the libraries I had installed are not found.
>
> I can run ruby with this alias:
>
> ruby='/usr/local/bin/ruby'
>
> Is there a way to get RubyGems and the libraries to be
> recognized by this new version? Or a way to install them
> into the new version?
Yes "no prob" ;-)
currently (apart from Apple's buggy ruby) i'm using two rubies install
one under /opt (MacPort) another one devoted to jRuby under my HOME/bin.
aliasing isn't sufficiant, u have also to setup your PATH such a way the
kernel hits /usr/local/bin before /usr/bin, afaik.
entering in ther terminal :
which ruby
gives you the "good" one ?
also did you setup in your env vars GEM_HOME, RUBYOPT and RUBYGEMS ?
another way to specify dirs is to use a ~/.gemrc see the on line man of
rubygems.
hoping that could help.
--
une bévue
Doug,
you need to add "/usr/local/bin" to your PATH variable. It's apparent
from this question that you don't understand some of the basics of
OSX's UNIX shell behavior. Here's a link [1] to a set of basic UNIX
tutorials which will give you a nice foundation for working in a
shell environment going forward.
In the meantime, fire up Terminal.app and do the following:
1. cd $HOME
2. echo 'PATH=/usr/local/bin:$PATH' >> .profile
3. echo 'export PATH' >> .profile
Make sure you use single quotes instead of double quotes!
Quit Terminal.app and then reopen it. At the shell prompt type 'which
ruby' to confirm it returns '/usr/local/bin/ruby' to you.
cr
[1] http://www.ee.surrey.ac.uk/Teaching/Unix/
Here's my setup now:
/usr/local/bin/ruby # latest ruby
/usr/lib/ruby/gems/1.8/gems/ # gems
Do I set:
GEM_HOME=/usr/lib/ruby/gems
or
GEM_HOME=/usr/lib/ruby/gems/1.8/gems
Also, it's not clear to what values to use for "user directory"
and the "mygemrepository" in the following (taken from the RubyGems
man page: http://rubygems.org/read/chapter/3)
Use the following to install RubyGems in a user directory
(here called /home/mystuff)
with a repository named /home/mygemrepository):
$ export GEM_HOME=/home/mygemrepository
$ ruby setup.rb config --prefix=/home/mystuff
$ ruby setup.rb setup
$ ruby setup.rb install
At the moment, I don't need RUBYOPT because I use
require 'rubygems'
What happens when you say "gem environment" at the command line? m.
--
matt neuburg, phd = ma...@tidbits.com, http://www.tidbits.com/matt/
Tiger - http://www.takecontrolbooks.com/tiger-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com
> Here's my setup now:
> /usr/local/bin/ruby # latest ruby
> /usr/lib/ruby/gems/1.8/gems/ # gems
I think you've installed rubygems using /usr/bin/ruby, the Apple's one ?
may be you didn't change your PATH hit before ?
> Do I set:
> GEM_HOME=/usr/lib/ruby/gems
> or
> GEM_HOME=/usr/lib/ruby/gems/1.8/gems
neither only :
GEM_HOME=/usr/lib/ruby/gems/1.8
but i would suspect you could enter into trouble, if i'm right, that's
to say you've installed rubygems with Apple's Ruby...
personaly in such a situation i would re-install rubygems to insure it
is linked to the right ruby.
>
> Also, it's not clear to what values to use for "user directory"
> and the "mygemrepository" in the following (taken from the RubyGems
> man page: http://rubygems.org/read/chapter/3)
>
> Use the following to install RubyGems in a user directory
> (here called /home/mystuff)
> with a repository named /home/mygemrepository):
>
> $ export GEM_HOME=/home/mygemrepository
> $ ruby setup.rb config --prefix=/home/mystuff
> $ ruby setup.rb setup
> $ ruby setup.rb install
no need for a repository except you want to download first and install
afterwards ?
otherwise gem is able to download remotely the gems you want to install.
>
> At the moment, I don't need RUBYOPT because I use
> require 'rubygems'
OK, fine.
--
une bévue
Basically, I put "/usr/local/bin" ahead of "/usr/bin" in my PATH in
~/.profile
Then I re-installed rubygem to "/usr/local" and
$ ruby setup.rb config --prefix=/usr/local
and re-installed all my gems, which automatically installed them into
/usr/local/lib/ruby/gems
----------------------------------------------------------------------------
Details below...
> I think you've installed rubygems using /usr/bin/ruby, the Apple's one ?
Yes. I installed rubygems when Apple's /usr/bin/ruby was the only
version on my Mac.
> may be you didn't change your PATH hit before ?
You mean change PATH to include /usr/local/bin/ruby before installing
rubygems?
That would be correct, since /usr/local/bin/ruby didn't yet exist when
I installed rubygems.
> personaly in such a situation i would re-install rubygems to insure it
> is linked to the right ruby.
Okay, I did succeed re-installing ruby gems
$ cd rubygems-0.9.1
$ ruby setup.rb config --prefix=/usr/local
I figured out which value to pass in to --prefix by looking in
setup.rb:
$ grep setup.rb | grep prefix
_stdruby = "$prefix/lib/ruby/#{version}"
The argument to --prefix should be clarified in
http://docs.rubygems.org/read/chapter/3
Calling "gem environment" now prints nicely:
$ gem environment
Rubygems Environment:
- VERSION: 0.9.0 (0.9.0)
- GEM PATH:
- /usr/local/lib/ruby/gems/1.8
...
> and re-installed all my gems, which automatically installed them into
> /usr/local/lib/ruby/gems
fine !
--
une bévue