attilagyorffy.com

Initial impressions with Ruby development on El Capitan

Introduction

Attila Györffy

Attila Györffy

I'm a Ruby/JS dev/trainer with a focus on quality. An ex-Londoner, @terracycle, @ubxd, @lastfm. Follow me at http://twitter.com/attilagyorffy


ruby environment osx elcapitan

Initial impressions with Ruby development on El Capitan

Posted by Attila Györffy on .
Featured

ruby environment osx elcapitan

Initial impressions with Ruby development on El Capitan

Posted by Attila Györffy on .

I have always been the guy who wasn't afraid of trying out betas of OS X with the goal to provide resolutions to development environment related issues so that by the time stable versions hit the market, everyone could upgrade because solutions are ready.

Today Apple released the very first beta of its new OS, OS X 10.11 El Capitan. To be honest, initially I wasn't going to install El Capitan but as it turned out, Yosemite crashed and burnt so many times that I decided to see whether this new revamped system will survive without major kernel panics for longer than a week... (so far it's good, fingers crossed.)

In this article I am going to try to share my findings, provide information on what seems to work and what looks like a pain.

Homebrew

Homebrew has no official support for pre-release software but as always the community is working really hard to address issues that arise as quickly as possible.

I had no issues with installing Homebrew itself, however some formulae might be tricky to install. Trouble is, Homebrew doesn't provide bottles (precompiled packages) of software for a pre-release platform. This means that it will attempt to build and compile everything from source.

Gems that need some help

Below a few of the gems that did not install automatically and so I had to fiddle around with.

Installing gems with native extensions to OpenSSL

Some gems need to install native extensions and bind to OpenSSL. Without any configuration, you may encounter errors like this:

fatal error: 'openssl/ssl.h' file not found  

The reason is that the compiler doesn't find the right header files, so we need to fix that using the CPPFLAGS event variable during the configuration step.

This is the case with the following gems:

  • eventmachine
  • puma

When installing a gem, you can pass in the --with-cppflags option to achieve this. -I adds a new directory to the include paths.

gem install eventmachine -- --with-cppflags=-I/path/to/the/header/files  

Obviously we will need to find the right path for this, but Homebrew's --prefix option comes to the rescue. We substitute the path above with the path we get back from brew:

$ gem install eventmachine -- --with-cppflags=-I$(brew --prefix openssl)/include

Note the brew --prefix openssl subcommand above.

This would work, you are now ready to bundle your application as the gem is installed so bundler will find it.

But let's take this further, let Bundler handle this al for us:

$ bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include

This interacts with Bundler's configuration system. It will also set that configuration to the value specified for all bundles executed as the current user. The configuration will be stored in ~/.bundle/config. This means that the next time you bundle an app, bundler will use the same configuration options. Bingo.

Attila Györffy

Attila Györffy

https://attilagyorffy.com

I'm a Ruby/JS dev/trainer with a focus on quality. An ex-Londoner, @terracycle, @ubxd, @lastfm. Follow me at http://twitter.com/attilagyorffy

View Comments...