How to Install Ruby on a Mac
basix

How to Install Ruby on a Mac

Tutorial Details
  • Topic: Installing Ruby
  • Tools Required: Mac, Terminal, Internet Access

This one is tailor made for the Basix users among you. If you’ve been itching to try out Ruby and/or Rails, if the Terminal is somewhat new to you, you may find that even the process of installing it can generate countless confusing errors. This article will detail the exact steps you need to follow to get Ruby up and running on your Mac.


Step 1 – RVM

What you might be interested to know is that Ruby comes preinstalled on your Mac. Don’t believe me? Open the Terminal and type:

ruby -v

Likely, the version number will return 1.8.7. While you might be tempted to stick with that, you probably shouldn’t for a couple reasons:

  • Old versions of the OS shipped with a buggy version of Ruby
  • RVM provides the flexibility to use any version of Ruby that you require. Plus, if you’re just starting out with Ruby, don’t use an old version; you want 1.9.2!

These days, RVM is the way the cool kids install Ruby, and that’s what we’ll use.

“RVM lets you deploy each project with its own completely self-contained and dedicated environment–from the specific version of ruby, all the way down to the precise set of required gems to run your application. Having a precise set of gems also avoids the issue of version conflicts between projects, which can cause difficult-to-trace errors and hours of hair loss. “

Open the Terminal, and type:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

If an error is returned when you run this command, make sure that you have Git installed. Don’t worry, it’s easy to setup!


Step 2 – Load RVM into the Shell

Give that a few seconds to install, and next, we need to make RVM available to the shell. We’ll do this by updating our ~/.bash_profile file.

cd ~/
sudo vim .bash_profile

Note that we’re using Vim to update this file, which can be a bit confusing at first. Feel free to open this file in any code editor your prefer. Maybe you want to use mate .bash_profile. Also, note that, if this file does not exist, you should create it manually. Paste the following to the bottom of the page.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

If you’re using Vim, you’ll need to press i to switch into Insert Mode first. Once the line has been pasted, press Escape, and then :wq! to save and close the file. If you’re using a different code editor, then you know what to do!


Step 3 – Restart Terminal

Just to be safe, let’s restart Terminal to make sure that everything took effect. To ensure that RVM is correctly installed, type:

rvm

You should see a long list of commands that are available to you. Good job; that part is out of the way.


Step 4 – Download the Latest Version of Xcode

From my experiences, the biggest gotcha is when you try to install a new version of Ruby with RVM, and you’re met with a handful of confusing errors. Most of the time, this is the result of Apple’s Xcode not being installed on your system, or, if it is, not being the current version.

You can download Xcode from Apple’s App Store. Search for “xcode” and click the install button.

Download XCode

You might want to fix yourself some lunch, as this large file will take some time to download. Once it does, though, run the install process, and, when finished, close Xcode. You shouldn’t need to restart your computer, but, if it keeps you in the good graces of the church, go ahead and do so.


Step 5 – Download Ruby 1.9.2

Next, restart Terminal, and type:

rvm list known

You’ll see a long list of versions…

$ rvm list known
# MRI Rubies
1.8.6[-p420]
1.8.6-head
1.8.7[-p352]
1.8.7-head
1.9.1-p378
1.9.1[-p431]
1.9.1-head
1.9.2-p180
1.9.2[-p290]
1.9.2-head
ruby-head
...

For our needs, let’s install Ruby 1.9.2

rvm install 1.9.2

That shouldn’t take but a moment.

If you still receive an error at this point, leave a comment below with your error message, and the rest of us will help you debug it. But, before doing so, type: rvm notes to determine if you’ve forgotten to install any dependencies.

Once the installation has completed, we need to tell RVM which version of Ruby we currently want to use:

rvm use 1.9.2

Next, test it by checking the version number:

ruby -v

On my computer, this returns ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]. Good job, you’re now using Ruby 1.9.2. There’s just one last thing to deal with.


Step 6 – Make 1.9.2 the Default

If you restart Terminal, and type ruby -v again, you’ll likely find that it has defaulted back to the system version of Ruby: 1.8.7. That’s no good! Let’s be sure to make 1.9.2 the default.

rvm --default use 1.9.2

This bit is identical to what we did just a moment ago – the only difference being that we’ve specified that 1.9.2 should be the default.


Step 7 – Finished. Begin Installing Gems

And that’s it! You’re all set to go! If you’d like to experiment with Ruby’s syntax, type:

irb
2 + 2

The next step is to install any gems that you require. For example, if you want to work with Ruby on Rails:

gem install rails

Or possibly Sinatra:

gem install sinatra

Important: Note that I’m not using sudo to install these gems. This is a big no-no when working with RVM. From the official docs:

“When you do sudo you are running commands as root, another user in another shell and hence all of the setup that RVM has done for you is ignored while the command runs under sudo (such things as GEM_HOME, etc…). So to reiterate, as soon as you ‘sudo’ you are running as the root system user which will clear out your environment as well as any files it creates are not able to be modified by your user and will result in strange things happening. (You will start to think that someone has a voodoo doll of your application…)”


Conclusion

If this tutorial seemed incredibly easy to you, that’s because it wasn’t intended for you. Not everyone is comfortable with the command line, and not everyone installs Ruby without first being met with a huge crop of errors. Hopefully, this article will help a bit. And, again, if you’re still having trouble, leave a comment, and we’ll do our best to help you out!

Alternatively to RVM, you also might look into rbenv, which, though quite new, is quickly gaining popularity.

You Also Might Like…

Add Comment

Discussion 90 Comments

  1. Grigory says:

    rbenv (+ ruby-build) > rvm

    https://github.com/sstephenson/rbenv

    much more unix-way and win

  2. Chris says:

    While I believe that this is an excellent guide on installing ruby, I’m a bit confused that the author thinks someone who needs help installing ruby is capable of handling vim.

    • Jeffrey Way says:
      Author

      Not capable of using Vim full-time, but capable of typing the three keys that I mention in the article. I also noted that, if they’d prefer, use a different code editor.

      And plenty of Vim users don’t work with Ruby.

      • Chris says:

        I didn’t want to insult you in any way. I’m sorry if it sounded that way.

        I’m currently trying to wrap my head around MacVim and I have to admit that I didn’t even got to type some words when I first opened it. This is why I posted this comment. When I was new to OSX and the command line, I felt very comfortable with nano because it was just like any other text editor so I’d recommend that. Just wanted to say that Vim can be quite confusing for newbies, e.g. If you accidentally hit a key and nothings seems to work anymore ;)

      • Jeffrey Way says:
        Author

        Hey Chris – No, wasn’t insulted at all. :) Just friendly conversation here.

      • Charley says:

        Why use a text editor at all? Copy pasta this:

        echo ‘[[ -s "$HOME/.rvm/scripts/rvm" ]] && source “$HOME/.rvm/scripts/rvm”‘ >> ~/.bash_profile

        *cough* Vim Sucks *cough*

    • Swami Atma says:

      Agree with @Chris. I don’t think it’s a good idea to recommend vim for newbies. Anything else would be better. Why not suggest to use TextEdit by default and recommend Textmate which most Rails developers use. Then as a 3rd option you can plug vim.

      Very good tutorial otherwise.

  3. Nice tuto, very useful. Thanks !

    • David DelMonte says:

      Agreed. I avoided Vim, but really appreciated the tutorial.

      I understand that there are easier ways now to install Ruby, but this gave me a bit of insight…

      Thanks for putting it together.

  4. Jeremy B. says:

    I’m getting an error code when I type in “bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)" what do I do now? I am a ruby enthusiast and just starting.

  5. Mehdi Raza says:

    Nothing for Windows users?


    SO has Apple bought net.tutsplus.com??

    • Swami Atma says:

      Hi Mehdi. The tutorial for Windows users is to go to the Apple store and buy an Imac or a MBP. :-)

    • redwall_hp says:

      Well, if you’re developing server-side software to run on Linux/Unix servers, developing on a POSIX-compliant OS makes a lot of sense.

      Plus, I’m willing to bet at least 65% of Nettuts+ subscribers are Mac/Linux users.

    • Mark Learst says:

      @Mehdi, redwall_hp hit the nail on the head.

      Here is a snippet from an older Smashingmag article:

      ——————————-

      1. Open Source Friendly

      As a web developer, if there’s one skill you invariably have to develop, it’s the use of a *NIX terminal. Luckily, because OSX is built on top of UNIX, the terminal is ready and waiting. Every Apple ships with a wide variety of open source programming tools and frameworks built in such as PHP, Apache, and Ruby on Rails. Linux users who have grown tired of dealing with hardware issues, especially on laptops, often choose a Mac as their portable solution because it is UNIX based.

      It means that the entire world of open source software out there is pretty much guaranteed to run without much hassle. In a world where open source software is a way of life, web developers need a friendly environment to operate in.

      ——————————-

      Lastly here’s a link for Window users:

      https://github.com/vertiginous/pik

    • Mehdi Raza says:

      Ahhhh, I live in Pakistan. Now I understand what the “Digital Divide” means….

      Macs are pretty expensive for me. No doubt Mac is more reliable than other systems, not to mention the awesome tools (like TextMate, other stuff) that you get to use, but developers have little option here. It’s either burn a hole in your pocket or go down the drain thing…. :-(

      Anyway, I like Nettuts, so no offence meant above.

  6. Peter Andres says:

    Thanks for this. Installing Ruby for a web designer is generally a nightmare. Most guides often leave out pieces and it is really easy to get stuck. I know for people familiar with the command line this stuff is easy, but me it was a huge learning curve.

    Any chance you can do tutorials on getting ruby running with apache (do people do this?) and mysql?

    Thanks again!

  7. Fily says:

    Nice tutorial. When are you going to start writing tutorials about Ruby? I’m a big fan of your tutorials.

  8. Greg Cashen says:

    I echo Jeremy B’s comment above.

    I’m getting an error code when I type in “bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)"

    Terminal returns:
    usage: dirname path

    What gives?

  9. bpr says:

    This comes very handy! My boss asked me to get into ruby and I think this might give me a solid start to set it up at least ;)

    Thanks for the work.

    All the best

  10. Yesterday for the first time I said I was going to try Ruby and went through tryruby.org and I said tomorrow I’m going to figure out how to install this on my Mac. Today I go to net tuts and the latest new article is none other than this! Perfect! I love this network! Thank you!

  11. Jenn says:

    Just a heads up – for this it suggests using xcode – but I believe the version in this article requires lion – I have tried to download the latest on snow leopard with any error. Otherwise, great tut!

  12. Had a problem with step 5, received the following errors immediately after the download completed:

    Extracting yaml-0.1.4.tar.gz to /Users/Joey/.rvm/src
    Configuring yaml in /Users/Joey/.rvm/src/yaml-0.1.4.
    ERROR: Error running ‘ ./configure –prefix=”/Users/Joey/.rvm/usr” ‘, please read /Users/Joey/.rvm/log/ruby-1.9.2-p290/yaml/configure.log
    Compiling yaml in /Users/Joey/.rvm/src/yaml-0.1.4.
    ERROR: Error running ‘/usr/bin/make ‘, please read /Users/Joey/.rvm/log/ruby-1.9.2-p290/yaml/make.log
    Installing yaml to /Users/Joey/.rvm/usr
    ERROR: Error running ‘/usr/bin/make install’, please read /Users/Joey/.rvm/log/ruby-1.9.2-p290/yaml/make.install.log
    ruby-1.9.2-p290 – #configuring
    ERROR: Error running ‘ ./configure –prefix=/Users/Joey/.rvm/rubies/ruby-1.9.2-p290 –enable-shared –disable-install-doc –with-libyaml-dir=/Users/Joey/.rvm/usr ‘, please read /Users/Joey/.rvm/log/ruby-1.9.2-p290/configure.log
    ERROR: There has been an error while running configure. Halting the installation.

    • Codie says:

      I’ve had the same error, can anyone let us know whats the deal?

    • Tim says:

      Same errors here too, anyone have any suggestions?

    • Dennis says:

      Same error (running osx lion…)

    • Dennis says:

      probably found it! downloading xcode from the app store is not the ready-to-go app, just the install files. open these install files and problem solved!

    • Jack says:

      Stuck on Step 5. gcc and Xcode are already installed so i doubt that’s it.
      It runs nicely until:
      ….
      Compiling yaml in /Users/jack/.rvm/src/yaml-0.1.4.
      Installing yaml to /Users/jack/.rvm/usr
      ruby-1.9.3-p0 – #configuring
      ERROR: Error running ‘ ./configure –prefix=/Users/jack/.rvm/rubies/ruby-1.9.3-p0 –enable-shared –disable-install-doc –with-libyaml-dir=/Users/jack/.rvm/usr ‘, please read /Users/jack/.rvm/log/ruby-1.9.3-p0/configure.log
      ERROR: There has been an error while running configure. Halting the installation.

      Any suggestions?

      • Eric says:

        Same problem as Jack:

        Compiling yaml in /Users/eric/.rvm/src/yaml-0.1.4.
        Installing yaml to /Users/eric/.rvm/usr
        ruby-1.9.3-p0 – #configuring
        ERROR: Error running ‘ ./configure –prefix=/Users/eric/.rvm/rubies/ruby-1.9.3-p0 –enable-shared –disable-install-doc –with-libyaml-dir=/Users/eric/.rvm/usr ‘, please read /Users/eric/.rvm/log/ruby-1.9.3-p0/configure.log
        ERROR: There has been an error while running configure. Halting the installation.

        running lion

    • Eric says:

      make sure you have xcode installed and this should get you past step 5.

    • Dorival says:

      Make sure you have the Command Line Tools installed after install your XCode, because it not come by default, this is simple, just:

      1. Launch your Xcode
      2) Open “Preferences” from the “Xcode” item on the menu bar.
      3) Select “Downloads” tab (icon).
      4) Click “Install” button for “Command Line Tools” [it has about 180MB]

      I got this instructions from a person from Stack Overflow, who got from this website:
      http://draft.scyphus.co.jp/macosx/lion.html

  13. Rakesh Kumar says:

    Installing ruby on mac is really a hard task to me but that for easiest steps. I can do my job now. Thanks.

  14. Miguel says:

    Nice tut, all what I needed. I had the following error when I was installing the 1.9.2:

    —–
    ERROR: Error running ‘make ‘, please read /Users/mdavila/.rvm/log/ruby-1.9.2-p290/make.log
    ERROR: There has been an error while running make. Halting the installation.
    —–

    Everything seemed to be ok and suddenly, crash!! After that if I type rvm use 1.9.2 it gives me
    ——-
    WARN: ruby ruby-1.9.2-p290 is not installed.
    To install do: ‘rvm install ruby-1.9.2-p290′
    ——-

    And if I type ruby -v it gives me:

    —–
    ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
    ——

    Maybe it is because I couldnt update the latest version of xCode? on the contray I have snow leopard and the last version for that, so!!! Too bad I guess :(

    Thanks a lot a very good job.

    Miguel.

  15. Sean says:

    My error – help!

    ~~~

    Sean-Daviess-MacBook-Pro:~ funkymonk1984$ rvm install 1.9.2
    Installing Ruby from source to: /Users/funkymonk1984/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)…

    ruby-1.9.2-p290 – #fetching
    ruby-1.9.2-p290 – #extracted to /Users/funkymonk1984/.rvm/src/ruby-1.9.2-p290 (already extracted)
    Fetching yaml-0.1.4.tar.gz to /Users/funkymonk1984/.rvm/archives
    Extracting yaml-0.1.4.tar.gz to /Users/funkymonk1984/.rvm/src
    Configuring yaml in /Users/funkymonk1984/.rvm/src/yaml-0.1.4.
    ERROR: Error running ‘ ./configure –prefix=”/Users/funkymonk1984/.rvm/usr” ‘, please read /Users/funkymonk1984/.rvm/log/ruby-1.9.2-p290/yaml/configure.log
    Compiling yaml in /Users/funkymonk1984/.rvm/src/yaml-0.1.4.
    ERROR: Error running ‘/usr/bin/make ‘, please read /Users/funkymonk1984/.rvm/log/ruby-1.9.2-p290/yaml/make.log
    Installing yaml to /Users/funkymonk1984/.rvm/usr
    ERROR: Error running ‘/usr/bin/make install’, please read /Users/funkymonk1984/.rvm/log/ruby-1.9.2-p290/yaml/make.install.log
    ruby-1.9.2-p290 – #configuring
    ERROR: Error running ‘ ./configure –prefix=/Users/funkymonk1984/.rvm/rubies/ruby-1.9.2-p290 –enable-shared –disable-install-doc –with-libyaml-dir=/Users/funkymonk1984/.rvm/usr ‘, please read /Users/funkymonk1984/.rvm/log/ruby-1.9.2-p290/configure.log
    ERROR: There has been an error while running configure. Halting the installation

  16. Woolwit says:

    I have the same error as Miguel running on Leopard with XCode 3.2.6 and git installed. I will say that with your tutorial I got farther along (it’s been years now) in my quest to install Ruby 1.9.2 on my Mac. I don’t get why this turns out to be fucking rocket science.

  17. I went through the tutorial, using TextMate instead of VI to edit .bash_profile. Everything went OK, but now, when I open a terminal, I get the message:

    in .bash_profile…
    -bash: /Users/richard/.rvm/scripts/rvm : No such file or directory

    Needless to say, when I type “rvm” at the terminal prompt, I get a “command not found” message.

    When I list the files in /Users/richard/.rvm/scripts/, there’s rvm sitting there:

    -rwxr-xr-x 1 richard staff 3500 Sep 16 13:06 /Users/richard/.rvm/scripts/rvm*

    Fwiw, the last lines in my .bash_profile are:

    # Installing RVM as per http://net.tutsplus.com/tutorials/ruby/how-to-install-ruby-on-a-mac/
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source “$HOME/.rvm/scripts/rvm”  # This loads RVM into a shell session.

    Any idea what I’m doing wrong?

    Thanks.

    Richard

  18. Woolwit says:

    I eventually was able to get 1.9.2 loaded. But it required every one of the steps outlined here: http://www.markhneedham.com/blog/2010/07/08/installing-ruby-1-9-2-with-rvm-on-snow-leopard/
    Which is kind of insane, for a beginner. This should either be easier, or people should stop saying how easy it is.

  19. shouro says:

    a quick info for ‘step 2′

    in mac os x use this:
    if [[ -s /Users/sss/.rvm/scripts/rvm ]] ; then source /Users/sss/.rvm/scripts/rvm ; fi

    instead of this:
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source “$HOME/.rvm/scripts/rvm”  # This loads RVM into a shell session.

  20. Davor says:

    Updating ruby to 1.9.3…

    Configuring yaml in /Users/Druidl/.rvm/src/yaml-0.1.4.
    ERROR: Error running ‘ ./configure –prefix=”/Users/Druidl/.rvm/usr” ‘, please read /Users/Druidl/.rvm/log/ruby-1.9.3-rc1/yaml/configure.log
    Compiling yaml in /Users/Druidl/.rvm/src/yaml-0.1.4.
    ERROR: Error running ‘/usr/bin/make ‘, please read /Users/Druidl/.rvm/log/ruby-1.9.3-rc1/yaml/make.log
    Installing yaml to /Users/Druidl/.rvm/usr
    ERROR: Error running ‘/usr/bin/make install’, please read /Users/Druidl/.rvm/log/ruby-1.9.3-rc1/yaml/make.install.log
    ruby-1.9.3-rc1 – #configuring
    ERROR: Error running ‘ ./configure –prefix=/Users/Druidl/.rvm/rubies/ruby-1.9.3-rc1 –enable-shared –disable-install-doc –with-libyaml-dir=/Users/Druidl/.rvm/usr ‘, please read /Users/Druidl/.rvm/log/ruby-1.9.3-rc1/configure.log
    ERROR: There has been an error while running configure. Halting the installation.

  21. Maxwell says:

    D’oh.

    Somehow in the process of attempting to complete step #2 in Terminal (running Lion) I seem to have erased every bash command?

    Typing anything after “$”, “.”, or “rvm” as the tutorial suggests in step #3 I receive the following error:
    -bash: command not found

    How do I “reset” my bash profile? This has, effectively, made my terminal unusable!

  22. Carl says:

    I have tried installing rails with a video from lynda.com and everything worked except this is what happens
    gem showing it’s there
    rack-test (0.6.1)
    rails (3.1.1)
    railties (3.1.1)
    rake (0.9.2.2, 0.8.7)

    rails -v
    Rails is not currently installed on this system. To get the latest version, simply type:

    rails -version
    Rails is not currently installed on this system. To get the latest version, simply type:
    I changed dir while trying to figure out what happened just to make sure of install I tried again and it installed again same response with version after the second time it seems to end right away like it knows it’s there and yes I added the path. If I go and get RVM will it be able to fix this? Thank you for your help.

  23. coredump says:

    Great tutorial! Everything went smoothly :) Thank!

  24. I don’t think we need to edit bash_profile anymore with the last RVM.

    When I kept this line:
    ‘[[ -s "$HOME/.rvm/scripts/rvm" ]] && source “$HOME/.rvm/scripts/rvm” # This loads RVM into a shell session.’

    it couldn’t find the file or directory

    I just delete this from the bash, and kept with the rest of the instalation

  25. janice says:

    Thanks for this tutorial.
    I’m afraid i’m stuck on #2.
    I am running OS10.5.8 and have installed GIT.
    When i enter ‘cd ~/’ and press enter and then ‘sudo vim .bash_profile’ and press enter i am prompted for a password…I am unable to type anything after the password prompt though, no characters type.

    Any ideas?

    Cheers

  26. Josh Kellman says:

    I’m getting this error message on #5.

    Installing yaml to /Users/joshkellman/.rvm/usr
    ruby-1.9.3-p0 – #configuring
    ERROR: Error running ‘ ./configure –prefix=/Users/joshkellman/.rvm/rubies/ruby-1.9.3-p0 –enable-shared –disable-install-doc –with-libyaml-dir=/Users/joshkellman/.rvm/usr ‘, please read /Users/joshkellman/.rvm/log/ruby-1.9.3-p0/configure.log
    ERROR: There has been an error while running configure. Halting the installation.

  27. Jack says:

    Step 5 does not work on if you’re trying to install 1.9.3
    I used 1.9.2 instead and it did not prompt any errors. The error might be that rvm is still version 1.9.2

    [Running Lion 10.7.2, Xcode 4.2.1, gcc 4.2.1.]

  28. Slo says:

    To install on 1.9.3 on Lion use this:

    rvm install 1.9.3 –with-gcc=clang

  29. Alex says:

    Hi Jeffery,

    Great simple to follow post, worked perfectly to others which left me with a million errors.

    I came across one issue when executing the following in step 7 installing Gems:

    gem install rails

    Terminal responded with :

    ERROR: While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

    I know you mention not to execute as with sudo but would this be an exception ? Thanks

  30. Ara says:

    ruby-1.9.2-p290 – #fetching
    ruby-1.9.2-p290 – #extracted to /Users/ajdarakjian/.rvm/src/ruby-1.9.2-p290 (already extracted)
    ruby-1.9.2-p290 – #configuring
    Error running ‘ ./configure –prefix=/Users/ajdarakjian/.rvm/rubies/ruby-1.9.2-p290 –enable-shared –disable-install-doc –with-libyaml –with-opt-dir=/Users/ajdarakjian/.rvm/usr ‘, please read /Users/ajdarakjian/.rvm/log/ruby-1.9.2-p290/configure.log
    There has been an error while running configure. Halting the installation.
    AJD-MBP:~ ajdarakjian$

  31. Shubz says:

    Hey I installed RoR recently with Git etc.

    But when I run the following:

    $ rails generate scaffold User name:string email:string

    I get this error:

    Artful-Dodgers-iMac:~ mohammedshuheb$ cd ~/rails_projects
    Artful-Dodgers-iMac:rails_projects mohammedshuheb$ cd demo_app
    Artful-Dodgers-iMac:demo_app mohammedshuheb$ rails generate scaffold Users name:string email:string
    /Users/mohammedshuheb/rails_projects/demo_app/config/application.rb:7: undefined method `groups’ for Rails:Module (NoMethodError)
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.11/lib/rails/commands.rb:15:in `require’
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.11/lib/rails/commands.rb:15
    from script/rails:6:in `require’
    from script/rails:6

    It keeps coming up with this error no matter what I do.

    I have reinstalled a few times and no luck!

    The versions I have installed are as follows:

    Rails 3.2.1
    Ruby 1.9.2p290

    And its all installed on a iMac.

    I also installed sqlite3 and tried with MySQL (I havent configured MySQL yet thats another problem for another day).

    Could I get some help please.

    Thanks!
    Shubz

  32. Mayank says:

    I got an error while compiling:
    configure: WARNING: unrecognized options: –with-libyaml
    checking build system type… x86_64-apple-darwin11.2.0
    checking host system type… x86_64-apple-darwin11.2.0
    checking target system type… x86_64-apple-darwin11.2.0
    checking whether the C compiler works… no
    configure: error: in `/Users/mayank/.rvm/src/ruby-1.9.3-p125′:
    configure: error: C compiler cannot create executables

    I think this is because my Xcode was not latest. This is how I fixed it:

    rvm install 1.9.3 –with-gcc=clang

  33. sharon says:

    Hi everyone,
    I got to step 5, but i got the following error message:

    Installing Ruby from source to: /Users/obi_sharon/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)…

    ruby-1.9.3-p125 – #fetching
    ruby-1.9.3-p125 – #extracted to /Users/obi_sharon/.rvm/src/ruby-1.9.3-p125 (already extracted)
    ruby-1.9.3-p125 – #configuring
    Error running ‘ ./configure –prefix=/Users/obi_sharon/.rvm/rubies/ruby-1.9.3-p125 –enable-shared –disable-install-doc –with-libyaml –with-opt-dir=/Users/obi_sharon/.rvm/usr ‘, please read /Users/obi_sharon/.rvm/log/ruby-1.9.3-p125/configure.log
    There has been an error while running configure. Halting the installation.

    Can anyone help me?

  34. Nate says:

    After installing the required dependencies I try to install Ruby, and get this error:

    ruby-1.9.3-p125 – #configuring
    Error running ‘ ./configure –prefix=/Users/2006MBP/.rvm/rubies/ruby-1.9.3-p125 –enable-shared –disable-install-doc –with-libyaml –with-opt-dir=/Users/2006MBP/.rvm/usr ‘, please read /Users/2006MBP/.rvm/log/ruby-1.9.3-p125/configure.log
    There has been an error while running configure. Halting the installation.

    Any ideas?

  35. Soul says:

    Great tutorial, but I can’t get past step 4; installing xcode. I downloaded xcode 3.2.6 from the apple developer’s site and trying to install on os 10.6.8, but every time is says installation failure with no clue as to why. I’ve tried creating another admin user and installing there with no success. I’ve googled and can’t find any clues. Any ideas?

  36. Felipe Ranieri says:

    Hi Everyone,

    I saw something really interesting and worked to me, so I’d like to share.
    As you may realize sometimes it can be very painful to download XCode (it’s an almost 2GB download).

    A big thanks to Kenneth Reitz which created a Github containing packages of isolated compiling headers for GCC.
    It’s available at : https://github.com/kennethreitz/osx-gcc-installer

    It’ll be an approximately 280MB download.
    There are two pre-built libraries available (for both OS X 10.7 Lion / OS X 10.6 Snow Leopard), and all I’ve got to do was download and install : RVM compiled successfully.

    Actually not only RVM but even other projects (even ruby itself : without RVM for testing purposes).
    Please just let me know if it works with you guys.

    Good luck, have fun!

    Best Regards,
    Felipe Ranieri

  37. Andre says:

    Error running ‘ ./configure –prefix=/Users/andregatorano/.rvm/rubies/ruby-1.9.2-p318 –enable-shared –disable-install-doc –with-libyaml –with-opt-dir=/Users/andregatorano/.rvm/usr ‘, please read /Users/andregatorano/.rvm/log/ruby-1.9.2-p318/configure.log
    There has been an error while running configure. Halting the installation.
    /Users/andregatorano/.rvm/scripts/functions/build: line 28: –version: command not found

    This came up. I got further along through the installation before Xcodes 4.3 was installed.

    • Giri Fox says:

      I had the same error. I have xcode installed.
      I got a few errors, but it kept going after the first two.

      Configuring yaml in /Users/girifox/.rvm/src/yaml-0.1.4.
      Error running ‘ ./configure –prefix=”/Users/girifox/.rvm/usr” ‘, please read /Users/girifox/.rvm/log/ruby-1.9.2-p318/yaml/configure.log
      Compiling yaml in /Users/girifox/.rvm/src/yaml-0.1.4.
      Error running ‘make ‘, please read /Users/girifox/.rvm/log/ruby-1.9.2-p318/yaml/make.log

      Last error from terminal is:
      ruby-1.9.2-p318 – #configuring
      Error running ‘ ./configure –prefix=/Users/girifox/.rvm/rubies/ruby-1.9.2-p318 –enable-shared –disable-install-doc –with-libyaml –with-opt-dir=/Users/girifox/.rvm/usr ‘, please read /Users/girifox/.rvm/log/ruby-1.9.2-p318/configure.log
      There has been an error while running configure. Halting the installation.
      /Users/girifox/.rvm/scripts/functions/build: line 28: –version: command not found

      • Giri Fox says:

        Just noticed it suggested I read ‘configure.log’ which says…

        checking for a BSD-compatible install… /usr/bin/install -c
        checking whether build environment is sane… yes
        checking for a thread-safe mkdir -p… config/install-sh -c -d
        checking for gawk… no
        checking for mawk… no
        checking for nawk… no
        checking for awk… awk
        checking whether make sets $(MAKE)… no
        checking for gcc… no
        checking for cc… no
        checking for cl.exe… no
        configure: error: in `/Users/girifox/.rvm/src/yaml-0.1.4′:
        configure: error: no acceptable C compiler found in $PATH
        See `config.log’ for more details

  38. selva says:

    hai guys :

    i cant installed ruby
    Error running ‘make ‘, please read /Users/admin/.rvm/log/ruby-1.9.3-p125/make.log
    There has been an error while running make. Halting the installation.
    This type of error accured so give some sollution

  39. Giri Fox says:

    I found my answers here.
    http://stackoverflow.com/a/9309510/1196169

    Basically, I needed GCC. I got it from here https://github.com/kennethreitz/osx-gcc-installer
    Installed that, done.

    Alternatively, within Xcode, you can make it install ‘command line tools’. I hadn’t done that. It’s actually the key step. However, my direct GCC install is equivalent alternative and much less GB.

  40. Tony says:

    And this is why I started learning Python, but hey I now have ruby on my machine ,ouch that was painful

  41. CD says:

    I had an error when running the command to install 1.9.2. Error is:

    Fetching yaml-0.1.4.tar.gz to /Users/csmith/.rvm/archives
    Extracting yaml-0.1.4.tar.gz to /Users/csmith/.rvm/src
    Configuring yaml in /Users/csmith/.rvm/src/yaml-0.1.4.
    Error running ‘ ./configure –prefix=”/Users/csmith/.rvm/usr” ‘, please read /Users/csmith/.rvm/log/ruby-1.9.2-p320/yaml/configure.log
    Compiling yaml in /Users/csmith/.rvm/src/yaml-0.1.4.
    Error running ‘make ‘, please read /Users/csmith/.rvm/log/ruby-1.9.2-p320/yaml/make.log

    Database file /Users/csmith/.rvm/config/packages does not exist.

    Installing Ruby from source to: /Users/csmith/.rvm/rubies/ruby-1.9.2-p320, this may take a while depending on your cpu(s)…

    ruby-1.9.2-p320 – #fetching
    ruby-1.9.2-p320 – #extracted to /Users/csmith/.rvm/src/ruby-1.9.2-p320 (already extracted)
    ruby-1.9.2-p320 – #configuring
    Error running ‘ ./configure –prefix=/Users/csmith/.rvm/rubies/ruby-1.9.2-p320 –enable-shared –disable-install-doc –with-libyaml –with-opt-dir=/Users/csmith/.rvm/usr ‘, please read /Users/csmith/.rvm/log/ruby-1.9.2-p320/configure.log
    There has been an error while running configure. Halting the installation.

  42. Sina says:

    having problems installing ruby 1.9.3. See below. Thank you for your help
    ________________

    Fetching yaml-0.1.4.tar.gz to /Users/xxx/.rvm/archives
    Extracting yaml-0.1.4.tar.gz to /Users/xxx/.rvm/src
    Configuring yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
    Error running ‘ ./configure –prefix=”/Users/xxx/.rvm/usr” ‘, please read /Users/sinakeshavarzi/.rvm/log/ruby-1.9.3-p194/yaml/configure.log
    Compiling yaml in /Users/xxx/.rvm/src/yaml-0.1.4.
    Error running ‘make ‘, please read /Users/xxx/.rvm/log/ruby-1.9.3-p194/yaml/make.log

    Database file /Users/xxx/.rvm/config/packages does not exist.

    Installing Ruby from source to: /Users/xxx/.rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)…

    ruby-1.9.3-p194 – #fetching
    ruby-1.9.3-p194 – #extracted to /Users/xxx/.rvm/src/ruby-1.9.3-p194 (already extracted)
    ruby-1.9.3-p194 – #configuring
    Error running ‘ ./configure –prefix=/Users/xxx/.rvm/rubies/ruby-1.9.3-p194 –enable-shared –disable-install-doc –with-libyaml –with-opt-dir=/Users/xxx/.rvm/usr ‘, please read /Users/xxx/.rvm/log/ruby-1.9.3-p194/configure.log
    There has been an error while running configure. Halting the installation.
    ls: /Users/xxx/.rvm/rubies/*/bin/ruby: No such file or directory

  43. Dwain says:

    I’ve found a tutorial (for Mac) that works for me, do yourself a favor and check it out

    http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-mac

  44. Mia says:

    Thank you for this! I had an unfinished rvm installation following the directions in the Ruby tutorial at teamtreehouse.com. It was so much easier with vim. I am a newbie but the directions were very clear.

  45. Anthony Arellano says:

    Sorry if this question might be asked above but I just really want to know why can’t I do ‘rvm install 1.9.2′ with Xcode 4.3 installed?

    its says i have a llvm based copy of gcc.. what to do?:|

  46. Patrick says:

    Great Tutorial and +1 for vim .. I have been using it for years as my primary text editor even though I am not a terminal guru and am just starting to learn ruby!

    Anyone who has not given Vim a go I would definitely try it … it will rock your world!

  47. jimalton says:

    Just like “janice November 15, 2011 at 3:58 pm”, on typing “sudo …” I got a warning that I’d better know what I’m doing before proceeding, but if I wanted to proceed then I’d have to give my password, which I did and then proceeded. I copied and pasted the script ([[ -s …), then I saw the instruction that I should have pressed “i” before attempting the paste. Since I’ve never used vi, this instruction should probably have come before the paste instruction. Although the instruction is to paste the script to the bottom, and the cursor resided at the top, for all I knew, when I pasted, the script would appear at the bottom. Anyway, the script appeared to be in the file so I went ahead and ESC and :wq!, hoping for the best. The best would be, as noted in step 3, to see a long list of commands on issuing the rvm command, but, as another commentator had found, rvm was invalid. What to do? I went back to the profile file, and the only way I know how to do that is to issue the sudo … command again. The script was there but it was missing the first few characters: [[ -s. So I deleted the script from the file, saved it, and re-edited it, this time issuing the insert command before pasting. I saved it, re-started Terminal, and issued the rvm command – but, again, it’s invalid. So I’m now wondering, with the warning that I had when I first issued the sudo command, what state my system is in. I now have something in my profile file that doesn’t do what is expected – will it do something unexpected? I hope the author of the article, or someone else, can advise me here.

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.