How to use Ruby on the OS X machines

We just flipped the switch on our new OS X image which brings you a Ruby version manager in the form of chruby and ruby-install.

Out of the box the system installed Ruby v2.0.0 is selected so if you want the latest and greatest version please specify it in your circle.yml like so:

    - echo "2.3.1" > .ruby-version

or checking a .ruby-version file into your repo. You can easily create one by running the same command in your repos directory with echo "2.3.1" > .ruby-version and then check it in with git add .ruby-version && git commit -am "Added .ruby-version file"

The available versions out of the box are:

1. chruby --system
2. chruby 2.1.9
3. chruby 2.2.5
4. chruby 2.3.1

, but you can always install a newer version with ruby-install like this:

    - sudo ruby-install ruby --HEAD

If you run into any issues please feel free to let our support team know.


Great updating!
Now we can use this feature, right?

Hi great feature, but chruby 2.3.1 doesnt seem to work for us

1 Like

seems like we need to run gem install bundler after chruby? but we get this

ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /Library/Ruby/Gems/2.0.0/gems/bundler-1.13.6/.codeclimate.yml

gem install bundler returned exit code 1

Action failed: gem install bundler

Yes you can. The new image is live on all our production machines.

Can you please open a support ticket? I’d like to take a closer look.


1 Like

hi @anon47539524, i started getting a similar error last night on my OS X machine. seems unrelated to any code changes we made. Can I be updated on the results as well?

gem install bundler --pre
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /Library/Ruby/Gems/2.0.0/gems/bundler-1.13.6/.codeclimate.yml

gem install bundler --pre returned exit code 1

Action failed: gem install bundler --pre

hey @philfung, @anon47539524 suggest workaround by doing something like chruby 2.3.1 && bundle <command>

1 Like

Same for us as well. Build system has broken, working fine yesterday and not today, with the following similar error :frowning:

gem install shenzhen
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /Library/Ruby/Gems/2.0.0/gems/shenzhen-0.14.2/Gemfile

gem install shenzhen returned exit code 1

Action failed: gem install shenzhen

thx a bunch @tflhyl , will give it a try!

@tflhyl your solutions works!

No luck

@betzerra It looks like you missed an extra & there. It should be chruby 2.2.5 && bundle install.

Just to follow up on this, the temporary solution (as mentioned above) is to use chruby 2.X.X before all calls to anything Ruby related.


chruby 2.3.1 && gem install bundler
chruby 2.3.1 && bundle install
chruby 2.3.1 && bundle exec pod install

If you are using rvm and your project includes a .ruby-version file, you can also do chruby $(cat .ruby-version | cut -d '-' -f 2) rather than having to hardcode the value in your circle.yml file.


please add sudo to your gem install shenzhen command.

Please excuse the inconvenience.


For now please take a look at @boostworthy 's answer.

I’m working on a longterm fix and a short term one as I post this.

In the future you’ll be able to use simply put your preferred Ruby version in a ~/.ruby-version file and chruby will pick that up by itself.

AH! Thanks! I missed that :smiley: :smiley: :smiley:

Could this update have impacted the way OSX installs code signing credentials? We are currently not finding the valid identities even though our last build yesterday found it no problem.

Currently getting this all throughout that step.

chruby: unknown Ruby: ruby-2.2.4

Did anyone test this? Because every line in circle.yml runs in its own shell, I had to prefix every step of ours that used ruby with chruby 2.3.1; export PATH; and then it worked

It’s pretty disappointing to have a feature like this counted as shipped and a blog post written about how to use it, when it doesn’t work and breaks all our builds and deployments. Maybe test this and do an opt-in roll out rather than breaking everything next time