Running Ruby on Rails after Yosemite upgrade

Only had to do this three times - so it is battle tested on my machines at least :)

tl;dr

xcode-install --select
brew update
brew upgrade
brew reinstall nginx

Long story

Apple’s new OSX Yosemite has been out for few weeks now - I have held out long enough and finally upgraded.

After upgraded - I upgraded all my homebrew packages just in case:

brew update
brew upgrade

And then I tried to run my Rails project. It won’t run, Nginx complained:

nginx: [emerg] mkdir() “/usr/local/var/run/nginx/client_body_temp” failed (2: No such file or directory)

Google took me to this Stackoverflow answer, just creating the directory doesn’t sound legit - so why not reinstall nginx? With homebrew it’s as easy as brew reinstall nginx.

Problem solved.

And then I tried to upgrade my gems for the project - I had a feeling that I will encounter some issues with native gems, and I was right, bundle install failed on mysql gem - with following error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/cemeng/.rubies/ruby-2.1.2/bin/ruby extconf.rb

checking for ruby/thread.h… *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.

Provided configuration options: –with-opt-dir –with-opt-include –without-opt-include=${opt-dir}/include –with-opt-lib –without-opt-lib=${opt-dir}/lib –with-make-prog –without-make-prog –srcdir=. –curdir –ruby=/Users/cemeng/.rubies/ruby-2.1.2/bin/ruby /Users/cemeng/.rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:456:in ’try_do’: The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/cemeng/.rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in ’try_cpp' …..

The error message was longer than that - but you see on the middle of that massive error block, it says:

You have to install development tools first.

So yes, do that: xcode-select –install

And that’s it - ready to work again!