Ruby 1.9 mac install problems

Following Dave Thomas' instructions in Programming Ruby 1.9, p. 7, I got
MacPorts for my MacBook Pro (Snow Leopard, version 10.6.8), then ran
sudo port install ruby19 from command line, which took a while and
looked like it succeeded. But after the install (and after rebooting),
I'm still showing Ruby 1.8.7 when I type $ ruby -v from command line.

I'm kind of guessing that it might be a path issue, but how do I change
things around so that I can code in 1.9 (without messing anything up
that potentially relies on 1.8.7)?

···

--
Posted via http://www.ruby-forum.com/.

Set up your path so that /opt/local/bin (I'm assuming that for macports) is in the front.

eg: PATH=/opt/local/bin:$PATH

···

On Jul 13, 2011, at 20:46 , Marshall Farrier wrote:

Following Dave Thomas' instructions in Programming Ruby 1.9, p. 7, I got
MacPorts for my MacBook Pro (Snow Leopard, version 10.6.8), then ran
sudo port install ruby19 from command line, which took a while and
looked like it succeeded. But after the install (and after rebooting),
I'm still showing Ruby 1.8.7 when I type $ ruby -v from command line.

I'm kind of guessing that it might be a path issue, but how do I change
things around so that I can code in 1.9 (without messing anything up
that potentially relies on 1.8.7)?

Ryan Davis wrote in post #1010623:

···

On Jul 13, 2011, at 20:46 , Marshall Farrier wrote:

Following Dave Thomas' instructions in Programming Ruby 1.9, p. 7, I got
MacPorts for my MacBook Pro (Snow Leopard, version 10.6.8), then ran
sudo port install ruby19 from command line, which took a while and
looked like it succeeded. But after the install (and after rebooting),
I'm still showing Ruby 1.8.7 when I type $ ruby -v from command line.

I'm kind of guessing that it might be a path issue, but how do I change
things around so that I can code in 1.9 (without messing anything up
that potentially relies on 1.8.7)?

Set up your path so that /opt/local/bin (I'm assuming that for macports)
is in the front.

eg: PATH=/opt/local/bin:$PATH

path is set correctly. I checked ~/.profile, and the macports setup put
in that path, which also shows up right at the beginning when i type $
echo $PATH. but i still get ruby 1.8.7 as version :frowning:

--
Posted via http://www.ruby-forum.com/\.

If you install ruby 1.9 via Macports using the command "port install
ruby19", the ruby's binaries will have the 1.9 suffix e.g. ruby1.9,
irb1.9, etc.

You have to use the nosuffix variants if you don't want the 1.9 suffix
i.e "port install ruby19 +nosuffix"

···

On Thu, Jul 14, 2011 at 1:07 PM, Marshall Farrier <info@marshallfarrier.com> wrote:

Ryan Davis wrote in post #1010623:

On Jul 13, 2011, at 20:46 , Marshall Farrier wrote:

Following Dave Thomas' instructions in Programming Ruby 1.9, p. 7, I got
MacPorts for my MacBook Pro (Snow Leopard, version 10.6.8), then ran
sudo port install ruby19 from command line, which took a while and
looked like it succeeded. But after the install (and after rebooting),
I'm still showing Ruby 1.8.7 when I type $ ruby -v from command line.

I'm kind of guessing that it might be a path issue, but how do I change
things around so that I can code in 1.9 (without messing anything up
that potentially relies on 1.8.7)?

Set up your path so that /opt/local/bin (I'm assuming that for macports)
is in the front.

eg: PATH=/opt/local/bin:$PATH

path is set correctly. I checked ~/.profile, and the macports setup put
in that path, which also shows up right at the beginning when i type $
echo $PATH. but i still get ruby 1.8.7 as version :frowning:

--
Posted via http://www.ruby-forum.com/\.

--
Thanh

Thanh Pham wrote in post #1010631:

things around so that I can code in 1.9 (without messing anything up

--
Posted via http://www.ruby-forum.com/\.

If you install ruby 1.9 via Macports using the command "port install
ruby19", the ruby's binaries will have the 1.9 suffix e.g. ruby1.9,
irb1.9, etc.

In other words, your system's ruby software is called 'ruby', and the
ruby software you just installed is called 'ruby1.9'. To check the
version of the program named 'ruby1.9':

$ ruby1.9 -v

and to run your ruby programs you have to type:

$ruby1.9 your_program.rb

The easiest thing to do is set up an alias for 'ruby1.9', e.g. 'r'.
Then you can run your programs with less typing, like this:

$r your_program.rb

or check the version like this:

$r -v

It's my understanding that Terminal checks the file ~/.bash_profile
before starting up, so you can put your aliases in there. If the file
doesn't exist (and it probably won't) then create it. The
~/.bash_profile file is where I have my PATH set:

export PATH=/Users/me/Downloads/rails_downloads/MacVim-7_3-53:$PATH

and at the bottom of the file I have the line:

source ~/.bashrc

which I think makes Terminal also read what's in the file ~/.bashrc
before starting up. I actually have my aliases in .bashrc.

If you need a good editor, spend a few minutes learning vim by typing:

$vimtutor

If you like what you see, then you can install Macvim and the vividchalk
colorscheme for a great combo.

···

On Thu, Jul 14, 2011 at 1:07 PM, Marshall Farrier > <info@marshallfarrier.com> wrote:

--
Posted via http://www.ruby-forum.com/\.

7stud -- wrote in post #1010642:

Thanh Pham wrote in post #1010631:

If you like what you see, then you can install Macvim and the vividchalk
colorscheme for a great combo.

Thanks for the great tips! ruby1.9 does show 1.9.2 as version.
I'll also definitely try the vim for mac you recommended. I have a
color-coded vim for Linux set up at work but have just been using the
pre-installed, plain version on mac. The color coding is nice.

Also, if my shebang for ruby 1.8 is #!/usr/bin/ruby -w, I should
presumably change it to #!/usr/bin/ruby1.9 -w (?).

···

--
Posted via http://www.ruby-forum.com/\.

Well, it may not have been "right," but this seems to have worked for me. I built from source. When I did the ./configure I used -prefix=/usr/bin. When I did the sudo make install, it didn't put the binaries in the right place (never actually found them), but everything else seemed right. I did a sudo cp to get the binaries from the build directory into /usr/bin. So far, no problems that I've seen. YMMV. For that matter, mine may, too if I do find a problem later.

···

-----Original Message-----
From: Marshall Farrier [mailto:info@marshallfarrier.com]
Sent: Thursday, July 14, 2011 10:53 AM
To: ruby-talk ML
Subject: Re: ruby 1.9 mac install problems

7stud -- wrote in post #1010642:

Thanh Pham wrote in post #1010631:

If you like what you see, then you can install Macvim and the
vividchalk colorscheme for a great combo.

Thanks for the great tips! ruby1.9 does show 1.9.2 as version.
I'll also definitely try the vim for mac you recommended. I have a color-coded vim for Linux set up at work but have just been using the pre-installed, plain version on mac. The color coding is nice.

Also, if my shebang for ruby 1.8 is #!/usr/bin/ruby -w, I should presumably change it to #!/usr/bin/ruby1.9 -w (?).

--
Posted via http://www.ruby-forum.com/\.