Bundle fails to resolve dependencies of sorbet
when using bundler 2.4 or later on macos. It works fine in docker with all bundler versions.
Works fine with bundler 2.3:
- Use MRI ruby, for example:
asdf local ruby 3.1.6
. I got the same issue with ruby 3.2 (did not test with ruby 3.3 because all our projects are still on ruby 3.1). - Install bundler
gem install bundler -v 2.3.27
- Create a Gemfile with this content:
source 'https://rubygems.org'gem 'sorbet', '>= 0.5.11647'
bundle install
fails:
Fetching gem metadata from https://rubygems.org/..Resolving dependencies...Could not find gem 'sorbet-static (= 0.5.11647)' with platform 'ruby', which is required by gem 'sorbet (>= 0.5.11647)', in rubygems repository https://rubygems.org/ or installed locally.The source contains the following gems matching 'sorbet-static (= 0.5.11647)': * sorbet-static-0.5.11647-aarch64-linux * sorbet-static-0.5.11647-java * sorbet-static-0.5.11647-universal-darwin * sorbet-static-0.5.11647-x86_64-linux
- Add darwin platform to resolve issue:
bundle lock --add-platform universal-darwin
bundle install
works now:
Fetching gem metadata from https://rubygems.org/.Using bundler 2.3.27Fetching sorbet-static 0.5.11647 (universal-darwin)Installing sorbet-static 0.5.11647 (universal-darwin)Fetching sorbet 0.5.11647Installing sorbet 0.5.11647Bundle complete! 1 Gemfile dependency, 3 gems now installed.Use `bundle info [gemname]` to see where a bundled gem is installed.
If we do the same with bundler
2.4.0 for example then we get the following error at step 6:
Resolving dependencies...Resolving dependencies...Could not find gem 'sorbet-static (= 0.5.11647)' with platforms 'ruby', 'universal-darwin' in locally installed gems.The source contains the following gems matching 'sorbet-static (= 0.5.11647)': * sorbet-static-0.5.11647-universal-darwin
The error message is different in bundler 2.4.22 (and bundler 2.5 seems to show this error as well):
Fetching gem metadata from https://rubygems.org/.Resolving dependencies...Resolving dependencies...Could not find gems matching 'sorbet-static (= 0.5.11647)' valid for all resolution platforms (ruby, universal-darwin) in rubygems repository https://rubygems.org/ or installed locally.The source contains the following gems matching 'sorbet-static (= 0.5.11647)': * sorbet-static-0.5.11647-aarch64-linux * sorbet-static-0.5.11647-java * sorbet-static-0.5.11647-universal-darwin * sorbet-static-0.5.11647-x86_64-linux
Can this be resolved? The docs says apple silicon isn't supported, but based on the above error the issue isn't related to M1. Any help is appreciated.