Ruby 1.9.3 and OS X Mountain Lion

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

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.

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

On Sep 14, 2012, at 12:00 , [email protected] 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).

On Fri, Sep 14, 2012 at 12:49 PM, Ryan D.
[email protected]wrote:

to databases, editors, etc).

Fwiw, I have homebrew working on my Mac and it works well.

Jos

[email protected] 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.

On Sep 14, 2012, at 16:20 , Matt N. [email protected] wrote:

[email protected] 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:

How I Installed Ruby 1.9.3

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?

Am 14.09.2012 20:17, schrieb Ryan D.:

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?

Ryan D. [email protected] 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.

Matt N. [email protected] wrote:

Ryan D. [email protected] 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.

Bob H. wrote in post #1076145:

On 2012-09-14, at 8:48 PM, Ryan D. [email protected] 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/// 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.

On 2012-09-14, at 8:48 PM, Ryan D. [email protected] wrote:

How I Installed Ruby 1.9.3

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

On Sep 16, 2012, at 13:00 , stomar [email protected] wrote:

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

yes, xcode is free. everything mentioned (iirc) is free.

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

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.

Am 14.09.2012 20:11, schrieb [email protected]:

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.