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).
Install Calabash-Android causes error on OS X Mavericks
I had the same problem and I just found out a solution for this.
I found one related problem here:
http://techespanto.wordpress.com/2013/03/29/upgrade-ruby-version-on-mac-osx/
and it suggested I had to upgrade the ruby version on my machine. The first two commands in that link are not working, so I leave you here what I did:
Install the command line tools for mac with:
xcode-select --install
Install homebrew in your mac with:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Install rvm with:
\curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enable
List the latest ruby versions with:
rvm list known
Install the latest ruby version with:
rvm install ruby-<version>
(for me it was ruby-2.1-head
)
And that's all. Hope it works for you as well!
How to downgrade application from Ruby 2.0.0 to 1.9.3
Do a commit in what ever versioning system you are using so you can roll back if needed. You should also update your ruby 1.9.3 to the latest 1.9.3-484.
rvm get stable
rvm upgrade 1.9.3
Uninstall your json gem
gem uninstall json
It may warn about dependencies, that should be OK since you will reinstall. Now bundle:
bundle install
You may have to do this with other gems until any that have different versions or dependencies based on the ruby version are installed in that environment.
edit
Since it isn't working for you and I can create a Rails 4.0.2 app on Ruby 1.9.3-p484 and run the server with json(1.8.1) just fine I would try this:
Create a new directory for your project, cd
into that directory, then set rvm to use the right ruby:
rvm use ruby-1.9.3-p484
then install rails for that gem set
gem install rails
Now create a new rails app with the same name as your old one
rails new ....
Then copy all of your application's files over to the new rails app. I think you could just overwrite everything. Don't copy over the Gemfile.lock file. In the new app's directory run
bundle install
this should add any gems you are missing in the new environment's gem set.
Ruby Gem install Json fails on Mavericks and Xcode 5.1 - unknown argument: '-multiply_definedsuppress'
I am encountering the exact same problem after updating Xcode to 5.1 and news from Apple aren't good. From Xcode 5.1 Release Notes:
- The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified.
Projects using invalid compiler options will need to be changed to remove those options. To help ease that transition, the compiler will temporarily accept an option to downgrade the error to a warning:
-Wno-error=unused-command-line-argument-hard-error-in-future
To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning.
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName
It seems that all gems violating the compiler options must be updated to use valid options. It is explicitly stated that: This option [downgrading error to warning] will not be supported in the future.
The clang note we are seeing (this will be a hard error (cannot be downgraded to a warning) in the future) corresponds to the change announced in the release notes.
To answer your question specifically, use the following to install the json gem:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install json
Note, however, that this is only a temporary fix.
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.
Error Installing Jekyll on Mac OS Mavericks (10.9.2)
Your problem appeared with Xcode 5.1. In order to avoid many problems related to MacOS' ruby version (this one and many others), you really should use RVM.
If you don't already have it, install Homebrew first: (it is not absolutely necessary, but allows us to install ruby and its dependencies without a looong compilation)
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Then, the following command will install RVM and the last version of Ruby:
\curl -L https://get.rvm.io | bash -s stable --ruby
Check everything is OK:
ruby --version
You can now install Jekyll:
gem install jekyll
Now, if you really don't want to use RVM, you can execute:
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install jekyll
But I bet further problems would come.
Related Topics
How to Get Words Frequency in Efficient Way with Ruby
How to Set a Cookie with a (Ruby) Rack Middleware Component
API Errors Customization for Rails 3 Like Github API V3
Why Are Metaclasses Created in Ruby
How to Make a Non-Blocking Request for an Exclusive Lock Using File#Flock
Regex to Match Hashtags in a Sentence Using Ruby
Dynamically Defined Setter Methods Using Define_Method
Adding a "Like/Unlike" Button to a Post in Rails
Memory Usage Increase with Ruby 2.1 Versus Ruby 2.0 or 1.9
Solving the Travelling Salesman Problem in Ruby (50+ Locations)
Rendering a JSON Object of a Join-Model and Its Associated Models
Examples of 'Things' That Are Not Objects in Ruby
Why Do I Get "Including Capybara::Dsl in the Global Scope Is Not Recommended!"