Ruby 3.4.5 on macOS SaaS runner breaks bundle install due to ffi incompatibility
Summary
GitLab SaaS macOS runners now use Ruby 3.4.5 by default, which causes bundle install to fail when native gems (e.g. ffi) are included in the Gemfile. These gems explicitly disallow Ruby ≥ 3.4, making it impossible to install the bundle. There is currently no way to override or downgrade the Ruby version in the macOS environment.
Steps to reproduce
Use the following job definition in a .gitlab-ci.yml file. This job fails due to ffi incompatibility with Ruby 3.4.5.
.gitlab-ci.yml
mac_build:
tags:
- saas-macos-medium-m1
image: macos-15-xcode-16
cache:
key: vendor-ruby
paths:
- vendor/
script:
- bundle config set --local path vendor/bundle
- bundle check || bundle install --jobs $(nproc)
- bundle exec fastlane build
Actual behavior
bundle install fails immediately with an error due to Ruby 3.4.5 being incompatible with ffi, which is used by cocoapods, fastlane, and other critical gems. This blocks iOS build pipelines.
Expected behavior
bundle install should succeed, either by:
- Using a Ruby version < 3.4 (e.g., 3.2 or 3.3), or
- Allowing the Ruby version to be overridden in the job definition (like on Linux runners)
Relevant logs and/or screenshots
job log
ffi-1.17.0-arm64-darwin requires ruby version < 3.4.dev, >= 2.5, which is incompatible with the current version, ruby 3.4.5p51
Environment description
- Shared GitLab.com SaaS Runners
- macOS executor
- Runner tag: saas-macos-medium-m1
- Image: macos-15-xcode-16
- Note: Xcode 15 builds are now rejected by Apple, so using older runner images is not a viable workaround.
Used GitLab Runner version
Running with gitlab-runner 18.4.0~pre.115.gb2218bab (b2218bab) on green-1.saas-macos-medium-m1.runners-manager.gitlab.com/default djQLaC-yp, system ID: s_74eebbcd1801
Possible fixes
- Provide the ability to select a Ruby version for macOS SaaS runners (like Linux runners)
- Provide a macOS runner image with Xcode 16 and Ruby < 3.4 until native gems like ffi are compatible