# Failing to Set Ruby Version with RVM

**URL:** <https://discuss.circleci.com/t/failing-to-set-ruby-version-with-rvm/17638>\
**Category:** Build Environment\
**Tags:** ruby, rvm, circle-yml\
**Created:** [October 25, 2017, 2:24pm UTC](https://discuss.circleci.com/t/failing-to-set-ruby-version-with-rvm/17638 "2017-10-25T14:24:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![everaldo](https://avatars.discourse-cdn.com/v4/letter/e/b9bd4f/32.png) [@everaldo](https://discuss.circleci.com/u/everaldo)\
**Post date:** [October 25, 2017, 2:24pm UTC](https://discuss.circleci.com/t/failing-to-set-ruby-version-with-rvm/17638/1 "2017-10-25T14:24:18Z")

</div>

Hi!

We are upgrading an application to Rails 4 and tests started to fail.  
We need Ruby 2.2.8, but CircleCI is running Ruby 2.3.1

I will post .circleci/config.yml

```auto
version: 2                                                                                                                                                                                                                                                                     
jobs:                                                                                                                                                                                                                                                                          
  build:                                                                                                                                                                                                                                                                       
    machine:                                                                                                                                                                                                                                                                   
      ruby:                                                                                                                                                                                                                                                                    
        version: "2.2.8"                                                                                                                                                                                                                                                       
    parallelism: 1                                                                                                                                                                                                                                                             
    working_directory: ~/circleci-demo-ruby-rails                                                                                                                                                                                                                              
    steps:                                                                                                                                                                                                                                                                     
      - checkout                                                                                                                                                                                                                                                               
      - run:                                                                                                                                                                                                                                                                   
          name: git                                                                                                                                                                                                                                                            
          command: git --version                                                                                                                                                                                                                                               
      - run:
          name: firefox
          command: firefox -version
      - run:
          name: rvm
          command: rvm version
      - run:
          name: install 2.2.8
          command: rvm install 2.2.8
      - run:
          name: use 2.2.8
          command: rvm use 2.2.8
      - run:
          name: ruby version
          command: ruby --version
      - run:
          name: mysql
          command: mysql --version
      - run: sudo service mysql restart
      - run: cp config/database.ci.yml config/database.yml
      - run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
      - run: mkdir ~/reports
      - run: RAILS_ENV=test bundle exec rake db:create db:structure:load
      - run: if [[! -e elasticsearch-5.5.1]]; then wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.tar.gz && tar -xvf elasticsearch-5.5.1.tar.gz; fi
      - run: bundle exec rake test
      - store_test_results:
          path: ~/reports

```

Error:

```auto
#!/bin/bash -eo pipefail
rvm version
Warning! PATH is not properly set up, '/opt/circleci/.rvm/gems/ruby-2.3.1/bin' is not at first place.
         Usually this is caused by shell initialization files. Search for 'PATH=...' entries.
         You can also re-add RVM to your profile by running: 'rvm get stable --auto-dotfiles'.
         To fix it temporarily in this shell session run: 'rvm use ruby-2.3.1'.
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
rvm 1.29.1 (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]

```

```auto
#!/bin/bash -eo pipefail
rvm install 2.2.8
Warning! PATH is not properly set up, '/opt/circleci/.rvm/gems/ruby-2.3.1/bin' is not at first place.
         Usually this is caused by shell initialization files. Search for 'PATH=...' entries.
         You can also re-add RVM to your profile by running: 'rvm get stable --auto-dotfiles'.
         To fix it temporarily in this shell session run: 'rvm use ruby-2.3.1'.
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Warning, new version of rvm available '1.29.3', you are using older version '1.29.1'.
You can disable this warning with: echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with: echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.2.8.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/.
Installing required packages: sqlite3, libgmp-dev, libgmp-dev|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/.
Requirements installation successful.
ruby-2.2.8 - #configure
ruby-2.2.8 - #download
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed

  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

100 23.0M 100 23.0M 0 0 3424k 0 0:00:06 0:00:06 --:--:-- 4512k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.8 - #validate archive
ruby-2.2.8 - #extract
ruby-2.2.8 - #validate binary
ruby-2.2.8 - #setup
ruby-2.2.8 - #gemset created /opt/circleci/.rvm/gems/ruby-2.2.8@global
ruby-2.2.8 - #importing gemset /opt/circleci/.rvm/gemsets/global.gems|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-.
ruby-2.2.8 - #generating global wrappers|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-.
ruby-2.2.8 - #gemset created /opt/circleci/.rvm/gems/ruby-2.2.8
ruby-2.2.8 - #importing gemset /opt/circleci/.rvm/gemsets/default.gems|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\.
ruby-2.2.8 - #generating default wrappers|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-\|/-.|/-\|/-\|.-\|/-.

```

```auto
#!/bin/bash -eo pipefail
rvm use 2.2.8
Warning! PATH is not properly set up, '/opt/circleci/.rvm/gems/ruby-2.3.1/bin' is not at first place.
         Usually this is caused by shell initialization files. Search for 'PATH=...' entries.
         You can also re-add RVM to your profile by running: 'rvm get stable --auto-dotfiles'.
         To fix it temporarily in this shell session run: 'rvm use ruby-2.3.1'.
         To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for an example.

```

```auto
#!/bin/bash -eo pipefail
ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

```

Any help is appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:40am UTC](https://discuss.circleci.com/t/failing-to-set-ruby-version-with-rvm/17638/2 "2018-06-18T11:40:01Z")

</div>

Closed on June 18, 2018, 11:40am UTC


