1

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

Community
  • 1
  • 1
MikalFM
  • 13
  • 6
  • 1
    Welcome to Stackoverflow, Mikal. Your question is off-topic here. Stackoverflow is a site for asking programming related questions. In a few minutes, your question will be closed, and migrated to Superuser.com where you will have much better luck! – Alan Apr 24 '11 at 20:07
  • 1
    @Alan I'm ok with that - But I don't see how this question is much different than the other StackOverflow question I linked to. [http://stackoverflow.com/questions/5639241/trouble-installing-rvm-on-a-mac/5738921#5738921](Question on Mac OS X 10.5.8). Perhaps you can provide me with some insight. – MikalFM Apr 24 '11 at 20:09
  • 2
    It *looks* like you've got a system-wide install of RVM instead of a single-user install going on. This is why you have to use `sudo` everywhere, and I think in this case the line in your `.bash_profile` won't work correctly. I'd recommend uninstalling RVM and installing again, making sure to get the single-user install script instead of the system-wide one (I think these days if you don't install as root, it automatically does the single-user install). – Michelle Tilley Apr 24 '11 at 20:50
  • 2
    @Alan, the question is not off topic here. RVM is a commonly used tool with Ruby, and there are a number of pre-existing questions regarding its use. Per the FAQ, acceptable topics are "software tools commonly used by programmers", which includes RVM. – the Tin Man Apr 24 '11 at 21:41
  • Thats my mistake, sorry! I assumed installation errors didn't fit the mold. Well thats why it takes more than 1 person to close a question :) – Alan Apr 25 '11 at 02:29
  • I wrote up my experience of RVM on 10.5.8 in response to another question, which might be useful: http://stackoverflow.com/questions/10574969/how-do-i-install-bash-3-2-25-on-mac-os-x-10-5-8/18090744#18090744 – Dave Everitt Aug 06 '13 at 21:31

3 Answers3

2

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.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • 1
    +1, this is not the correct way to fix your problem, and probably created additional problems. Deleting the system `ruby` likely made RVM's ruby "work" due to the fact your path is wrong--I still think this stems from an incorrect RVM installation (so your `bash_profile` can't load up RVM). – Michelle Tilley Apr 24 '11 at 22:07
  • @Brandon followed your advice and un-installed and re-installed. Much cleaner no more sudo stuff. Still have an issue where the defaults aren't sticking. – MikalFM Apr 24 '11 at 22:55
  • What does `rvm list default` return? You don't still have that manually edited `PATH` in your `.bash_profile` (at least the part for the wrong RVM install) do you? – Michelle Tilley Apr 24 '11 at 23:09
  • `$ rvm list default`returns ` Default Ruby (for new shells) ruby-1.9.2-p180 [ i386 ]` I removed the manually edited PATH from bash_profile. – MikalFM Apr 25 '11 at 12:22
1

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.

oma
  • 38,642
  • 11
  • 71
  • 99
  • uninstalled rvm, reinstalled rvm without any sudo commands. Much cleaner, no more headaches with sudo stuff. but I still can't get '$ rvm --default use 1.9.2' to stick once I close out my terminal session. Both rvm list and rvmsudo rvm list return the same thing. Any ideas on whats causing the default not to stick? – MikalFM Apr 24 '11 at 22:53
  • being paranoid, put `--default` last. Do you have a `=>` in front of any of the rubies (from rvm list, marks the default)? what does `which rvm` and `which ruby` – oma Apr 24 '11 at 22:56
  • 1
    "I still can't get '$ rvm --default use 1.9.2' to stick once I close out my terminal session. Both rvm list and rvmsudo rvm list return the same thing. Any ideas on whats causing the default not to stick", that's because you didn't read the directions RVM printed to your screen. Add the RVM initializer to your `~/.bashrc` file, then read the output of `rvm notes` and do what it says. – the Tin Man Apr 25 '11 at 02:36
  • @Ole No solution yet. I have tried it with the default at the end, doesn't give a new behavior. `which ruby` returns `/opt/local/bin/ruby`and `which rvm` returns `/usr/local/bin/rvm` when I run `rvm list`the right ruby is highlighted `=> ruby-1.9.2-p180 [ i386 ]`yet when I enter `ruby -v` I still get `ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin9]` – MikalFM Apr 25 '11 at 12:29
  • @the tin man I didn't have a .bashrc file but I created one and added the rvm initializer thats in my bash_profile. the output of `rvm notes`are written for snow leopard, but I've done what it said and imported and exported gems to the system-- still no luck getting it to stick once I close my terminal – MikalFM Apr 25 '11 at 12:33
  • stick to .bash_profile, paste it to your question. Follow the instructions of rvm notes, it's not much more than the *snow* that differs between snow leopard and leopard. `which ruby` should point to a ruby within ~/.rvm/rubies. – oma Apr 25 '11 at 13:39
  • @Ole thank you for helping, but I'm not sure I understand your comment. What do you mean "paste it to your question?" I already have the rvm initializer in my .bash_profile and I return `rvm is a function` from `type rvm | head -1` even on new sessions. I have also already followed the instructions of `rvm notes` And as you point out at the end, I'm still trying to figure out how to get `which ruby` to point to `~/.rvm/rubies` – MikalFM Apr 25 '11 at 14:10
  • I think RVM used to say to put the initializer in ~/.bashrc, but I just checked and it's in ~/.bash_profile now. – the Tin Man Apr 25 '11 at 17:59
  • 1
    @MikalFM, "I already have the rvm initializer in my .bash_profile" but, it's in the wrong place. Please carefully read [the Post Install instructions for installing RVM](https://rvm.beginrescueend.com/rvm/install/). The initializer _must be last_ in the file. – the Tin Man Apr 25 '11 at 18:04
  • @Tin Man. Thanks for continuing to help (and for your save of that ruby file). from the way I interpretted it, it needs to be the last code run. And it is above, but just in case I also tried putting it at the very end. Both tested successfully returning `rvm is a function` from `$ type rvm | head -1` I hope there is an obvious solution to this- I just can't figure it out. – MikalFM Apr 25 '11 at 21:20
  • @Tin Man you were on to the underlying issue when you said it was in the wrong place. – MikalFM Apr 26 '11 at 02:15
-2

maybe you should just add:

rvm use 1.9.2

to your .bash_profile file :)

Esse
  • 3,278
  • 2
  • 21
  • 25