Do you want ruby/bundler to skip a gem install on a certain platform, but any other platform needs that gem?
The obvious answer would be the following, which would result in also clobbering your Gemfile.lock
if bundling on macOS:
gem "openssl", "= 3.2.0" if RUBY_PLATFORM !~ /darwin/
But bundler has its own method, install_if
, to accomplish such a conditional install.
install_if -> { RUBY_PLATFORM !~ /darwin/ } do openssl "= 3.2.0" end