Can anyone please give directions on how to install ruby 1.9 I tried installation directions given all over the web. Can't get it to work. Please kindly give step by step direction. I tried using macports but everytime I type in ruby -v it gives me 1.8.6.
9 Answers
rvm is easiest way to manage your ruby installation on OSX.
If you are using rvm, you will able to install 1.9.1, 1.9.2, jruby, ree by typing rvm install 1.9.1
type rvm default
to reset your ruby version back to 1.8.6
How to install rvm
sudo gem install rvm -s http://gemcutter.org/
rvm-install
rvm install 1.9.1
rvm use 1.9.1
ruby -v # show ruby 1.9.1 version
rvm default
ruby -v # show ruby 1.8.6 version
cheers
-
Hi Bry4n, Tried but encounter a block, please help: stackoverflow.com/questions/3209269/…– KenJul 13, 2010 at 0:32
-
-
It appears the installation instructions above may be outdated; For latest RVM installation instructions see: rvm.beginrescueend.com/rvm/install– tjmehtaMar 24, 2012 at 16:39
-
~/.rvm/bin/rvm-installer ; you will probably have to add rvm to path yourself Jun 4, 2012 at 19:09
Use Ruby Version Manager. It will allow you to install most versions of Ruby and help you manage gems across them.
Ok this is how I remember doing it
- Install Macports
- Type
sudo port install ruby19
- Make sure that
/opt/local/bin
is in your path. If not add it. - Now to use ruby1.9 you type
ruby1.9 example.rb
Also additionally if you dont want to use ruby
command to use the default version. You can create a simple symlink in which make the ruby at /usr/bin/ruby
point to /opt/local/bin/ruby1.9
.
That way your ruby version will be 1.9. However I dont recommend doing that. As there are certain gems, that might not work with 1.9, which might be affected
-
can you please give direction on how to make sure that /opt/local/bin is in your path.– KenDec 10, 2009 at 3:13
-
fire up the terminsal and type
echo $PATH
, if you see /opt/local/bin there you are fine.To ad it to your PATH this article will helphttp://hayne.net/MacDev/Notes/unixFAQ.html#executionPath
– ShivDec 11, 2009 at 16:30
Not sure if you ever solved this. But it sounds like 1 of 2 problems:
1. You installed the wrong ruby with MacPorts
if you just ran port install ruby
, then you installed the old version, which explains why ruby -v
still shows 1.8.6.
If you ran port install ruby19
, then you installed ruby 1.9, but under the name ruby19. To access it, you'd have to type ruby19
in place of ruby
...so ruby19 script/generate
, ruby19 -v
...etc.
To fix that you can do port install ruby19+nosuffix
2. you still have your PATH set to the old Ruby, which is why you're getting 1.8.6 on ruby -v
.
First you gotta figure out where OSX is looking for your ruby by typing which ruby
. If you're using MacPorts, that command should return /opt/local/bin/ruby
. If which ruby
returns /usr/bin/ruby
, then it's still finding the default ruby that comes with OSX, which is 1.8.6.
To change your PATH, go open up .bash_profile, located in your user folder (if you have textmate, you can do mate
~/.bash_profile). Add in this line and save:
echo PATH="/opt/local/bin:/opt/bin:$PATH"
Basically you add the MacPorts ruby into your PATH, so the system looks for ruby in the /opt
folder too. Also, maybe more importantly, you put the MacPorts path in front of the default PATH, so it will find that one first.
Goodluck with that. Personally though, I vote for Homebrew. You can find my setup for that at my blog.
-
Hi FunkyMunky, Great Blog, ran into a block, not sure if I messed up my system files already, but this is the error I get: kapplej-4:homebrew Home$ curl -L github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C homebrew % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 121 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0tar: homebrew: Cannot chdir: No such file or directory tar: Error is not recoverable: exiting now– KenJul 13, 2010 at 1:22
-
22 283k 22 66374 0 0 182k 0 0:00:01 --:--:-- 0:00:01 182k curl: (23) Failed writing body kapplej-4:homebrew Home$– KenJul 13, 2010 at 1:24
-
Hey Ken. Not entirely sure what your error is, but the instructions on that blog are a little outdated now. For updated instructions go to the website. I'd recommend running the script under 'Quick Install to /usr/local' unless you know what you're doing. Jul 14, 2010 at 17:28
On my MacBook Pro I just did a good old compile and install. Download the 1.9.1 source from the Ruby web site (www.ruby-lang.org) and then compile. It'll install to /usr/local/bin so you will not corrupt the 1.8 if you wanted to revert back.
I never used the ports myself, but I know a lot that have/do. http://hivelogic.com/articles/ruby-rails-leopard is a good online guide for people not familiar with compiling and installing from source code.
Just had to do this on a factory-fresh Mac last night, and it's gotten slightly more complicated recently. GCC is no longer directly supported by Apple, as they prefer Clang, and Xcode 4.3+ requires the command line tools to be installed separately before you can access Clang from the terminal. So here goes!
1.) Install XCode.(it's free!)
2.) Install RVM. Go to a terminal window and enter:
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
3a.) If you've installed XCode before 4.3, skip this step. Go to Xcode>Preferences>Downloads tab and install the XCode command Line Tools. This will let you access clang from Terminal.
3.)Open up terminal and enter:
rvm install 1.9.3 --with-gcc=clang
this will install ruby 1.9.3 in OSX
- Install MacPorts
- Type
port install ruby19
-
I get the following error: kapplej-4:~ Home$ port install ruby19 Warning: MacPorts running without privileges. You may be unable to complete certain actions (e.g. install). ---> Computing dependencies for ruby19 ---> Dependencies to be installed: libiconv gperf ncurses ncursesw openssl zlib readline ---> Installing gperf @3.0.4_0 Error: Target org.macports.install returned: MacPorts requires root privileges for this action Error: The following dependencies failed to build: libiconv gperf ncurses ncursesw openssl zlib readline– KenJul 13, 2010 at 0:24
-
Error: Status 1 encountered during processing. To report a bug, see <guide.macports.org/#project.tickets> kapplej-4:~ Home$ ruby-v -bash: ruby-v: command not found– KenJul 13, 2010 at 0:25