Set ruby version

Hi, I need to set a specific version of ruby (2.3.1) to run my lanes. I tried using rvm but I failed. Do you have any guide on how I can Install and set 2.3.1?

We don’t have any ruby version manager pre-installed.

Why do you need exactly 2.3.1? Our Xcode 8.x build VMs have either 2.3.1 or 2.3.3 preinstalled right now

Xcode 8.0 stack is on 2.3.1 -

Xcode 8.3 stack is on 2.3.3 -

I need to setup that version of ruby because is the version set in our Gemfile.

We CI setup that works with that
I want to test bitrise without affect the existing configurations

The reason why we don’t have RVM, chruby or another ruby version manager preinstalled is because Xcode (Xcode’s command line tools) did have issues in the past when ruby was installed through RVM (see e.g. ) or any other ruby version manager.

Additionally, Ruby patch releases should be compatible, so Ruby 2.3.3 should work where 2.3.1 did (and in general patch releases do include important security/stability fixes).

You’re of course free to install and use any Ruby version manager ( ).

I’m just curious, which ruby version manager do you use on your Mac @lucabartoletti ?

Probably the fastest solution to switch between Ruby versions on macOS right now is to use brew.
Homebrew recently started to provide versioned minor Ruby versions.

They are still working out the details of their versioning, right now it looks like this:

set -ex

# uninstall the previously installed ruby version
brew uninstall ruby
# install the minor version you want
brew install ruby@2.2
# "activate" this version
brew link --force ruby@2.2

Unfortunately there’s no way to specify a patch level/version too, only the major+minor versions, and brew will install the latest patch version for that major+minor version, but this shouldn’t cause issues in general.

Hello @viktorbenei,

Any updates on how to use ruby@2.3 on Bitrise? My application uses ruby@2.3 and I can’t make it work. It seems the previous options for the stack with Xcode no longer have ruby@2.3 pre-installed. I also tried installing a new ruby version, but I can’t make bundler work. I’m using this stack:

brew uninstall ruby
brew install ruby@2.3
brew link --force --overwrite ruby@2.3
gem install bundler
bundle install

Then I get the following
/bin/sh: /usr/local/bin/bundle: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory

Hi @Remoov,
Could you send us the URL of the build that failed, so we can have a look at the logs?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.