Using my macOS Monterey v12.6, I'm trying to run Bundle Install
in my Ruby on Rails projects and it stops working.
This is the message I get when I get after it stops.
Fetching racc 1.6.0
Installing racc 1.6.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/myself/.rvm/gems/ruby-2.6.1/gems/racc-1.6.0/ext/racc/cparse
/Users/myself/.rvm/rubies/ruby-2.6.1/bin/ruby -I /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0 -r
./siteconf20220930-1192-12lr3he.rb extconf.rb
checking for rb_block_call()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/myself/.rvm/rubies/ruby-2.6.1/bin/$(RUBY_BASE_NAME)
/Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file.
(RuntimeError)
You have to install development tools first.
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:782:in `try_func'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:1069:in `block in have_func'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/2.6.0/mkmf.rb:1068:in `have_func'
from extconf.rb:6:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/myself/.rvm/gems/ruby-2.6.1/extensions/x86_64-darwin-19/2.6.0/racc-1.6.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/myself/.rvm/gems/ruby-2.6.1/gems/racc-1.6.0 for inspection.
Results logged to /Users/myself/.rvm/gems/ruby-2.6.1/extensions/x86_64-darwin-19/2.6.0/racc-1.6.0/gem_make.out
An error occurred while installing racc (1.6.0), and Bundler cannot continue.
Make sure that `gem install racc -v '1.6.0' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rails was resolved to 6.1.5, which depends on
actioncable was resolved to 6.1.5, which depends on
actionpack was resolved to 6.1.5, which depends on
actionview was resolved to 6.1.5, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri was resolved to 1.13.3, which depends on
racc
Ruby Version:
ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin19]
I tried running rails -v
and this is the response to that:
traceback (most recent call last):
8: from /Users/myself/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `<main>'
7: from /Users/myself/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `eval'
6: from /Users/myself/.rvm/gems/ruby-2.6.1/bin/rails:23:in `<main>'
5: from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:297:in `activate_bin_path'
4: from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:297:in `synchronize'
3: from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:299:in `block in activate_bin_path'
2: from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems.rb:232:in `finish_resolve'
1: from /Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:175:in `require'
/Users/myself/.rvm/rubies/ruby-2.6.1/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:175:in `ensure in require': CRITICAL: RUBYGEMS_ACTIVATION_MONITOR.owned?: before false -> after true (RuntimeError)
Anyways, Rails in Gemfile:
gem 'rails', '~> 6.1.4', '>= 6.0.4.6'
I already tried solving the issue by doing the solution from this
After updating macOS, run xcodebuild -runFirstLaunch
and you'll finally be able to successfully run Bundle Install
and Bundle Update
in your Ruby projects.