Forum: Ruby Ruby 1.9.3 and OS X Mountain Lion

Posted by unknown (Guest)
on 2012-09-14 20:12
(Received via mailing list)
Hi all,

I am using Ruby in an introductory computer science class in Highschool.
Of course, to keep things simple, I would like all my students to use
the same Ruby version (1.9.3p194).

At school we use W*****s machines and most of the students also use it
at home, but a few use Linux or OS X. Myself, I'm a convinced Linux user
so I do want to encourage my students to use a non-W*****s operating
system.

Problem is I have never used OS X and need some help from you
experienced users out there:

it seems that by default Ruby is already installed on OS X, but in
the wrong (for our purposes) version, 1.8.7. I think the student
who pointed that out to me uses Mountain Lion (maybe Lion).

What would be the least painful option, in your opinion:

- somehow uninstall the preinstalled version and install 1.9.3
   (I fear this could break the system, assuming Ruby is
    needed for some system tool(?) since it's already installed)

- install rvm

- ...?

- tolerate that students use different versions
   (this might mean higher effort for me when providing
    unit tests for programming tasks etc.)

Any hint is highly appreciated.
Posted by Ryan Davis (Guest)
on 2012-09-14 20:19
(Received via mailing list)
Don't bother uninstalling. It'll just come back in updates.mapple leaves 
/usr/local completely alone, so edit /etc/paths to have /usr/local/bin 
first. Then, install Xcode via the AppStore so you can compile ruby and 
gems with c extensions. Then install Mac homebrew and use that to 
install ruby 1.9. Rvm is nice in certain contexts but really isn't 
necessary and overly complicates things.
Posted by Wayne Brisette (Guest)
on 2012-09-14 20:21
(Received via mailing list)
As a Mac OS X user, and fairly novice Ruby scripter, I would recommend 
leaving
1.8 alone on the system. Simply have them install RVM, then use RVM to 
install
Ruby 1.9.3 and manage the Ruby version on the computer. This is the 
easiest way,
in my opinion, to install Ruby updates. In addition, if there is desire 
to
revert back, it's a simple switch in RVM.

Wayne
Posted by unknown (Guest)
on 2012-09-14 21:01
(Received via mailing list)
Am 14.09.2012 20:17, schrieb Ryan Davis:
> Don't bother uninstalling. It'll just come back in updates.mapple leaves 
/usr/local completely alone, so edit /etc/paths to have /usr/local/bin first. 
Then, install Xcode via the AppStore so you can compile ruby and gems with c 
extensions. Then install Mac homebrew and use that to install ruby 1.9. Rvm is 
nice in certain contexts but really isn't necessary and overly complicates things.
>

Thanks Ryan and Wayne.

I slightly tend to avoiding rvm. I do use it, but I'm not sure whether
it would be too complicated from the students' point of view.

@Ryan: How about gems in this setting? Would installation or usage of
gems work without additional adjustments?

@Wayne: *Sounds* easy... how smooth is the installation?
Posted by Ryan Davis (Guest)
on 2012-09-14 21:49
(Received via mailing list)
On Sep 14, 2012, at 12:00 , sto.mar@web.de wrote:

> @Ryan: How about gems in this setting? Would installation or usage of gems work 
without additional adjustments?

yup... it should just work. I recommend `gem update --system`, but 
that's not strictly necessary. 1.9 ships with rubygems and homebrew 
(unlike many linux distros) doesn't cripple it. The other nice thing is 
that going the homebrew route opens up a lot of other things to the 
student (easy access to databases, editors, etc).
Posted by Jos Backus (Guest)
on 2012-09-14 22:10
(Received via mailing list)
On Fri, Sep 14, 2012 at 12:49 PM, Ryan Davis 
<ryand-ruby@zenspider.com>wrote:

> to databases, editors, etc).
>
> Fwiw, I have homebrew working on my Mac and it works well.

Jos
Posted by Matt Neuburg (Guest)
on 2012-09-15 01:22
(Received via mailing list)
<sto.mar@web.de> wrote:

> What would be the least painful option, in your opinion:

It happens that I just did this (install 1.9.3 on Snow Leopard and
Mountain Lion machines), and here's how:

http://www.apeth.com/nonblog/stories/ruby193.html

m.
Posted by Ryan Davis (Guest)
on 2012-09-15 02:49
(Received via mailing list)
On Sep 14, 2012, at 16:20 , Matt Neuburg <matt@tidbits.com> wrote:

> <sto.mar@web.de> wrote:
>
>> What would be the least painful option, in your opinion:
>
> It happens that I just did this (install 1.9.3 on Snow Leopard and
> Mountain Lion machines), and here's how:
>
> http://www.apeth.com/nonblog/stories/ruby193.html

I disagree with this route. As you can see, homebrew makes things 
simpler for you:

  depends_on :autoconf if build.head?
  depends_on 'pkg-config' => :build
  depends_on 'readline'
  depends_on 'gdbm'
  depends_on 'libyaml'

boom. done. esp for a student... why should they bother with something 
more complex as well as error prone?
Posted by Bob Hutchison (Guest)
on 2012-09-15 16:15
(Received via mailing list)
On 2012-09-14, at 8:48 PM, Ryan Davis <ryand-ruby@zenspider.com> wrote:

>> http://www.apeth.com/nonblog/stories/ruby193.html
>
>

Does a homebrew install put gems into /usr/local? And do you still have 
to muck with your PATH? I can't remember. If 'yes' and 'no' then 
homebrew is definitely the way to go I think. Anything else brings RVM 
back into consideration.

RVM is the alternative route, but RVM can be crazy making. Homebrew and 
RVM are not mutually compatible. A lot of the complexity of RVM can be 
made manageable by http://unfiniti.com/software/mac/jewelrybox which I'm 
using myself these days (which is why I can't answer my own question 
about the homebrew installation).

Cheers,
Bob
Posted by Matt Neuburg (Guest)
on 2012-09-15 17:35
(Received via mailing list)
Ryan Davis <ryand-ruby@zenspider.com> wrote:

>
> something more complex as well as error prone?
I see no error prone-ness. I've now done this on four different Mac OS X
installations using representing three different systems. I can do it
reliably with my eyes closed. m.
Posted by Matt Neuburg (Guest)
on 2012-09-16 01:49
(Received via mailing list)
Matt Neuburg <matt@tidbits.com> wrote:

> Ryan Davis <ryand-ruby@zenspider.com> wrote:
>
> > boom. done. esp for a student...

Actually the rbenv way is even more boom-done. Once he's done the
installation once on his machine, the .rbenv folder is totally
self-contained. Ruby 1.9.3 is in it, and ready to run. So he has to do
is zip it up, put it where his students can download it, and say
"download this, unzip it in your Home folder, and name the unzipped
folder .rbenv." No muss, no fuss.

m.
Posted by Brian Candler (candlerb)
on 2012-09-16 13:26
Bob Hutchison wrote in post #1076145:
> On 2012-09-14, at 8:48 PM, Ryan Davis <ryand-ruby@zenspider.com> wrote:
> Does a homebrew install put gems into /usr/local? And do you still have
> to muck with your PATH?

Homebrew installs stuff under /usr/local/Cellar/<pkg>/<version>/ and 
then installs symlinks into /usr/local/bin/ for the binaries, so you 
don't have to muck about with PATH.

As for gems, the formula contains the following:

    # Put gem, site and vendor folders in the HOMEBREW_PREFIX
    ruby_lib = HOMEBREW_PREFIX/"lib/ruby"
    (ruby_lib/'site_ruby').mkpath
    (ruby_lib/'vendor_ruby').mkpath
    (ruby_lib/'gems').mkpath

    (lib/'ruby').install_symlink ruby_lib/'site_ruby',
                                 ruby_lib/'vendor_ruby',
                                 ruby_lib/'gems'

(where HOMEBREW_PREFIX defaults to /usr/local, I believe). That is, I 
believe /usr/local/lib/ruby/gems will be symlinked into the correct 
place. However I haven't actually installed ruby 1.9 on my Mac, as I 
only use 1.8.
Posted by stomar (Guest)
on 2012-09-16 22:01
(Received via mailing list)
Are all the various options free (as in "free beer")?
Ryan mentioned the AppStore.

I won't be able to report success or problems before a couple of days,
but thanks already for the many hints and suggestions.

Marcus
Posted by Ryan Davis (Guest)
on 2012-09-17 09:11
(Received via mailing list)
On Sep 16, 2012, at 13:00 , stomar <sto.mar@web.de> wrote:

> Are all the various options free (as in "free beer")?
> Ryan mentioned the AppStore.

yes, xcode is free. everything mentioned (iirc) is free.
Posted by unknown (Guest)
on 2012-10-13 09:59
(Received via mailing list)
Am 14.09.2012 20:11, schrieb sto.mar@web.de:
> it seems that by default Ruby is already installed on OS X, but in
> the wrong (for our purposes) version, 1.8.7. I think the student
> who pointed that out to me uses Mountain Lion (maybe Lion).
>
> What would be the least painful option, in your opinion:

Again, thanks for all suggestions. Here a late update on this post:
I did not recommend it but the student absolutely wanted to try RVM.
Up to now it works fine without any problems.
Posted by Alec Taylor (Guest)
on 2012-10-13 12:12
(Received via mailing list)
Using OSX Mountain Lion, used brew install to get latest ruby, the
deleted /usr/bin/ruby and symlinked the new one into there.

No problems thus far.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.