开发者

Updating to Ruby 1.9.2 on Leopard 10.5.8 using RVM

There seems to be a lot documented on migrating to 1.9.2 via snow leopard but not a lot on Leopard specifically.

running Mac OS X Leopard 10.5.8 rvm 1.6.3 xcode 3.1.4

I had a hard time installing rvm to begin with- but used this fix and got rvm installed. I type:

$ rvmsudo rvm install ruby-1.9.2-head
Install of ruby-1.9.2-head - #complete

(I get a failure if I try install without a sudo command) To switch default versions:

$ rvmsudo rvm --default use ruby-1.9.2-head
Using /usr/local/rvm/gems/ruby-1.9.2-head

$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin9]

When I set it as the default without a sudo command.

rvm --default use ruby-1.9.2-head

I get an error log that ends with:

cp: /usr/local/rvm/bin/rdoc: Permission denied
cp: /usr/local/rvm/bin/ri: Permission denied
cp: /usr/local/rvm/bin/ruby: Permission denied
cp: /usr/local/rvm/bin/testrb: Permission denied

Then I type

$ ruby -v
ruby 1.9.2p188 (2011-03-28 revision 31204) [i386-darwin9.8.0]

But when I close out terminal and reopen it is back to 1.8.7

Any ideas on how to get this ruby install to stick as my default?

Here is my bash profile

PS1="\u$ "
alias ll="ls -lahG"

export PATH="/usr/local/rvm/rubies/ruby-1.9.2-head/bin:/usr/local/bin:/usr/loca$

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loa$

##
# Your previous /Users/mikalfm/.bash_profile file was backed up as /Users/mikal$
##

# MacPorts Installer addition on 201开发者_如何转开发1-04-23_at_21:38:56: adding an appropriate $
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.


# MacPorts Installer addition on 2011-04-23_at_21:38:56: adding an appropriate $
export MANPATH=/opt/local/share/man:$MANPATH
# Finished adapting your MANPATH environment variable for use with MacPorts.

UPDATE

Solved. I went to the file location from 'which ruby' (the 1.8.7 version) Backed up the file and deleted it. Now ruby -v returns ruby 1.9.2p188 (2011-03-28 revision 31204) [i386-darwin9.8.0]

See comment below about why this was a bad idea.


Update 2

Solved, Really Unless of course I did something dumb. So after following the instructions from the thread- I cleared up all of the Sudo issues in the original question. I did it by uninstalling RVM using an implode command, removing the folder and reinstalling without using any sudo commands.

The following problem was I could force rvm to use 1.9.2 as a default for only one session at a time. I just fixed this by reading this stackthread force rails to use 1.9.2 in it someone proposed using the $ echo $PATH command. I did it and it looked fundamentally different than what I thought was in my bash profile.

It looked like /opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Users/mikalfm/.rvm/gems/ruby-1.9.2-p180/bin:/Users/mikalfm/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/mikalfm/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/mikalfm/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin

Turns out, I thought a few lines in my .bash_profile were commented out by ## and weren't. export PATH=/opt/local/bin:/opt/local/sbin:$PATH and export MANPATH=/opt/local/share/man:$MANPATH. They directly contradict what I thought was my $PATH export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

I deleted those lines from my profile. I figure I can add them back in if and when there is a dependency and I need to use Mac Ports again. Again, some one let me know if this is the wrong approach, but it works for me now even when I start a new terminal.


Solved. I went to the file location from 'which ruby' (the 1.8.7 version) Backed up the file and deleted it. Now ruby -v returns ruby 1.9.2p188 (2011-03-28 revision 31204) [i386-darwin9.8.0]

NO NO NO!

The version of Ruby installed by Mac OS in /usr is owned by Apple and installed for their use. Applications installed by Apple use it, and you could have broken them.

If you run find /usr -name '*.rb' you'll find a number of files used by Apple, that are not part of the normal Ruby install.


It's not a problem of 10.5, I use it on my MB pro too. You need to learn to stop using sudo, when you do your not in scope of 'Mikal' anymore. I seldom have to use that anymore.

I'm not too familiar with rvmsudo. What happens when you do

rvm list    
rvmsudo rvm list

?

My advice, uninstall rvm installed as root (with sudo), re-try and follow the guide at rvm.beginrescued.com remove the PATH ruby1.9.2/bin from .bash_profile to avoid confusion. Let rvm handle it, and stay off sudo and rvmsudo (I've never used the latter).

rvm install 1.9.2
rvm use 1.9.2 --default
rvm list #see your rubies

should be sufficient. Hope it helps.


maybe you should just add:

rvm use 1.9.2

to your .bash_profile file :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜