Error while installing Cocoapods 1.0

I got

Gem::InstallError: activesupport requires Ruby version >= 2.2.2.
An error occurred while installing activesupport (5.0.0), and Bundler cannot
continue.
Make sure that `gem install activesupport -v '5.0.0'` succeeds before bundling.

See screenshot

Any ideas?

1 Like

The default version of Ruby on OS X is a bit too old, and it looks like a recent update to this gem is causing issues.

The best thing to do would be to downgrade to the previous version of this gem while we work on updating Ruby (or at least allowing people to chose a different version of Ruby) on the OS X build machines.

Hello betzerra,

We are aware of this issue and we are working to find a more permanent solution. The default ruby version on the image is dated. It looks like this specific gem requires a newer version of ruby. In the mean time, can you please trying adding the following to your circle.yml file:

machine:
  pre:
    - brew remove ruby20
    - brew install ruby

Let us know how it goes!

1 Like

No luck, failed on the bundler step:

cd "Example"
bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs 4 --retry 3
bash: /usr/local/lib/ruby/gems/2.0.0/bin/bundle: /usr/local/opt/ruby20/bin/ruby: bad interpreter: No such file or directory
bash: /usr/local/lib/ruby/gems/2.0.0/bin/bundle: /usr/local/opt/ruby20/bin/ruby: bad interpreter: No such file or directory

cd "Example"
bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs 4 --retry 3
 returned exit code 126

Action failed: Run bundler

Sorry about that, I think you need to reinstall bundler since the version that is already installed was compiled against the old version of Ruby.

Can you try adding that?

machine:
  pre:
    - brew remove ruby20
    - brew install ruby
    - gem install bundler

@levlaz @AndrewBarba ok, this worked on my end but… SPOILER ALERTS… it’s dirty.

Gemfile

source 'https://rubygems.org'
gem 'cocoapods', '= 1.0.1'
gem 'activesupport', '= 4.2.4'
gem 'xcpretty'

circle.yml

machine:
  pre:
    - brew remove ruby20
    - brew install ruby
    - gem install bundler
  xcode:
    version: 7.3

# Need to explicit init and update its submodules
# https://discuss.circleci.com/t/automatically-load-git-submodules/159/7
checkout:
  post:
    - git submodule sync --recursive
    - git submodule update --recursive --init
    - bundle install
    - bundle exec pod install --project-directory=Example/

# Override test commands
test:
  override:
    - set -o pipefail &&
      xcodebuild
        CODE_SIGNING_REQUIRED=NO
        CODE_SIGN_IDENTITY=
        PROVISIONING_PROFILE=
        -sdk iphonesimulator
        -destination 'platform=iOS Simulator,OS=9.3,name=iPhone 6'
        -workspace Example/App.xcworkspace
        -scheme "App-Example"
        clean build test |
      tee $CIRCLE_ARTIFACTS/xcode_raw.log |
      xcpretty --color --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml

Please, let me know if there’s a way to make this cleaner. Thanks :slight_smile:

1 Like

I made some of the changes detailed in this thread. I changed my circle.yml file thusly:

machine:
  pre:
    - brew remove ruby20
    - brew install ruby
    - gem install bundler
    - gem install xcpretty

and my GemFile looks like this:

source 'https://rubygems.org'

gem 'cocoapods', '= 1.0.1'

The change to my circle.yml file fixed my issue with seeing the error message that betzerra originally reports, but now CocoaPods sometimes takes too long to install (>10mins) and CircleCI aborts!

Please help!