Install any version of ruby with RVM on mavericks
If you haven't upgraded Xcode after upgrading to Mavericks you should do so
After that, open a command prompt and type:xcode-select --install
This will install xcode command tools that have been deleted by OSX update.
After that it should work okay.
Unable to install Ruby with RVM
Once you have gcc46 insall you need to set it as the default compiler. You can find information on different ways to do that here: Setting GCC 4.2 as the default compiler on Mac OS X Leopard
Then as that output says, use brew tap --repair
and brew doctor
which gives you more info.
Ruby on Rails Mac OSX Mavericks issues after RVM install
Your first set of errors will go away if your remove the hidden .rvmrc
file in your project directory:
$ rm .rvmrc
The file only exists to set a Ruby version and gemset when you cd
into the directory. You can either set the Ruby version and gemset manually, or create new .ruby-version
and .ruby-gemset
files which are compatible with RVM and other version managers. For details, see my answer Use rvmrc or ruby-version file to set a project gemset with RVM?.
You may need to remove and reinstall the Ruby version you are using. Here's how:
$ rvm remove ree-1.8.7-2012.02
Here's the documentation.
You probably don't need to uninstall RVM. But if you do, you can use
$ rvm implode
to remove all traces of RVM before re-installing (documented here). For more details on installing Ruby and multiple versions of Rails using RVM, see the article I wrote:
- Install Ruby on Rails - Mac OS
X
Lastly, since you mention that you are reading a tutorial that requires an old version of Rails, may I politely suggest you have a look at a book I've written for beginners that is up to date with the newest version of Rails (currently Rails 4.1 but I revise the book with every new release). I hope it is helpful:
- Learn Ruby on
Rails
I mention my article and my book because they provide additional information about setting your development environment for Rails using RVM and may answer further questions for you.
Trouble downgrading Ruby on OS X Mavericks
10.9 is an early beta build of the OS. [Edit: please note the July 2013 date of this answer] If I were running 10.9 I would assume I'll have to reinstall the operating system from scratch at least 2 more times. (At least once during the beta cycle because, well, it's beta, and once when 10.9 comes out in general release, because, well, beta).
Given this I suggest four courses of action (pick 1 or many):
- Work with the RVM guys and dig into 10.9's probably-changed compiler environment and get Ruby 1.8.7 compiling. This is trickier because technically this stuff is under NDA.
- Instead, set up a VM and run Ruby 1.8.7 on the VM. Bonus points for using Vagrant and Chef/Puppet, because you may even need to rebuild the VM. (Just keep the Vagrantfile and Puppet or Chef config files on Github/Dropbox/whatever so you can clone them and regenerate your VM from scratch.)
- OR simply reboot to 10.8 to get production work done. 10.8 is a production level OS, 10.9 should be treated with caution - it could eat your work. It really shouldn't be used for production purposes (aka: day to day writing Ruby code). If you're writing a 10.9 only app in Cocoa/Objective-C (or updating RubyMotion or something) that might be another thing (but I'd still keep good backups and treat it gently).
- Work towards updating your code base for Ruby 2.0, as Ruby 1.8.7 is no longer officially supported anyway.
Edit (Oct 24, 2013): If you're here because you just installed Mavericks (released Oct 22, 2013), want to get Ruby 1.8.7 working a few days after this release, and RVM isn't working for you (because you're impatient and can't wait), here's what you can do (which should work, although I'm not an rbenv user):
- Use macports to install
port install ruby
. This is Ruby 1.8.7. This compilation worked for me on my Mavericks machine (although you will need to install Macports from source at this writing and install the command line developer tools, even if you have XCode 5 installed. Yes, really). - Now, install rbenv.
- Symlink
/opt/local/bin/ruby1.8
in the~/.rbenv/versions/
folder. Specifically~/.rbenv/versions/ruby-1.8.7-p374
- Read the rbenv documentation, but it should work now! (At least from the documentation. Again, not an
rbenv
user, but do play one on TV)
I'm sure you can do this with homebrew too, but I know Ruby 1.8.7 installs correctly with the latest Macports, because that's what I use (and it just installed cleanly for me).
Is it possible to install Ruby 1.9.3-p327 on OS X Mavericks? And if so, how?
If it's not neccesary to use rvm to install this version of ruby, you can use rbenv. I just installed this exactly version without any problems. And it's easy to install it with brew
.
If it won't work, then the problem in another place.
OS X Mavericks install rvm WARNING
When you install rvm its paths get added to ~/.bash_profile
. RVM will warn you about this during installation as you noticed. You could run source ~/.profile
each time you load the terminal, but that's a pain in the neck.
From the bash docs:
When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.
What this means is that /.bash_profile
is being run, and /.profile
and /.bashrc
are being ignored.
To resolve this just open .bash_profile
and copy the rvm paths at the top and paste them at the top of your .bashrc
file. Open a new terminal window and it should be working just fine.
You can either delete .bash_profile
, if it's empty, or copy and paste the contents of ~/.profile
into it if you choose to keep it.
Related Topics
Access Instance Variable from Outside the Class
How to Get the Target of a Symlink
Uninitialized Constant Rake::Dsl in Ruby Gem
Rails: Copying Attributes from an Object to Another Using the "Attributes" Method
How to Override a Column in Rails Model
Match String That Doesn't Contain a Specific Word
Migrating from Rails 2 to Rails 3
One Liner in Ruby for Displaying a Prompt, Getting Input, and Assigning to a Variable
Why Bundle Install Is Installing Gems in Vendor/Bundle
How to Make a Ruby String Safe for a Filesystem
How to Share Variables Across My .Rb Files