1

I'm having trouble setting up the compy 486 to use Ruby 1.9.3. I installed homebrew using _why's instructions (http://poignant.guide/book/expansion-pak-1.html) but when I check which version is installed it's still 1.8.7.

From what I understand this is because now there are two version of ruby installed. (See: How can I switch to ruby 1.9.3 installed using Homebrew?)

See:

Last login: Fri Feb 22 17:20:40 on ttys000
MacBook-Air:~ andrew$ brew install ruby
Error: ruby-1.9.3-p385 already installed
To install this version, first `brew unlink ruby'
MacBook-Air:~ andrew$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
MacBook-Air:~ andrew$ 

I read I should install Ruby Version Manger, but when I try that I get problems.

MacBook-Air:~ andrew$ $ \curl -L https://get.rvm.io | bash -s stable --ruby
-bash: $: command not found

So is there an easy way I can access my newer version of ruby 1.9.3 even if it's not used by default?

Dave Powers
  • 2,051
  • 2
  • 30
  • 34
Andrew
  • 658
  • 8
  • 8
  • Your RVM installer command should be: `curl -L https://get.rvm.io | bash -s stable --ruby` (you added "`$`" to the command; that just represented the command prompt) hence the `$: command not found` error. – Paul Fioravanti Feb 23 '13 at 01:50
  • I didn't realize you could run OS X on a Compy 486! – echristopherson Feb 24 '13 at 19:14

2 Answers2

4

I would suggest you use rbenv (https://github.com/rbenv/rbenv).

rbenv is simpler and lighter than RVM, plus it is friendly to your system (RVM overrides the CD and GEM commands which is somewhat worrisome).

Once you install rbenv (I would use homebrew, directions on the rbenv github page linked above) you can do this magic:

rbenv install 1.9.3-p392

Note that because RVM overrides basic system commands you cannot have RVM and rbenv installed together.

Dave Powers
  • 2,051
  • 2
  • 30
  • 34
Austin Lin
  • 2,545
  • 17
  • 17
  • Note that after you install rbenv you need to create ~/.rbenv/plugins and install ruby-build: https://github.com/sstephenson/ruby-build – rainkinz Feb 23 '13 at 02:43
  • the instructions on the wiki walk you through a homebrew install and includes commands to install ruby-build – Austin Lin Feb 23 '13 at 03:34
  • Ok, I uninstalled RVM but having trouble with that last step. --- unknown7c11be8d1064:~ andrew$ brew update Already up-to-date. unknown7c11be8d1064:~ andrew$ brew install rbenv Error: rbenv-0.4.0 already installed But, afterward: Downloading yaml-0.1.4.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/36c852831d02cf90508c29852361d01b Installing yaml-0.1.4... BUILD FAILED ......... configure: error: in `/var/folders/y7/hf8_898n6mz4rn1c2121qqd80000gp/T/ruby-build.20130223180104.8873/yaml-0.1.4': configure: error: C compiler cannot create executables See `config.log' for more details – Andrew Feb 24 '13 at 02:01
  • To be clear, I got through: $ brew update $ brew install rbenv $ brew install ruby-build, but get an error message when I use "rbenv install 1.9.3-p392". – Andrew Feb 24 '13 at 02:05
  • can you post the contents of config.log? – Austin Lin Feb 24 '13 at 06:20
3

The fact you still get the system default Ruby even after installing a current version through Homebrew is a simple issue of $PATH definitions: OS X’ system Ruby is installed in /usr/bin, while Homebrew installs its version in /usr/local/bin, which, by default comes after /usr/bin in your $PATH.

To get the newly installed Ruby, specify the full binary path, i.e. /usr/local/bin/ruby. If you want to make that the default, you could, of course, use a Ruby version manager (RVM and rbenv being the best known ones), but simply altering your $PATH to put /usr/local/bin before /usr/bin will do the trick too.

kopischke
  • 3,393
  • 1
  • 21
  • 40
  • Homebrew now installs to `/usr/local/Cellar/ruby/2.6.1/bin/ruby`. The above solution same can now be achieved by placing `/usr/local/Cellar/ruby/2.6.1/bin` first in the `$PATH` environment variable declaration. – kilogic Oct 21 '19 at 16:09
  • Two remarks: one, to the best of my knowledge Homebrew has always installed the Ruby executable outside `/usr/local/bin`, the `ruby` found there being a symlink. Two, setting your path to the origin of the symlink I’d consider inadvisable, as that path is version dependent (the `2.6.1` bit), so you would have to update your `$PATH` definition every time Homebrew’s Ruby updates – hence the symlink and my recommendation in the answer. – kopischke Oct 21 '19 at 20:46