Running Ruby on Rails on Apple Silicon (M1/M2): Debugging Racc and Tailwindcss Issues
While working on a new Ruby on Rails app, I encountered an issue I hadn't seen before. The last Rails app I built was on my old Intel MacBook, but now I'm on an M1 MacBook Pro with the Apple Silicon chip.
Issue #1: racc/parser.rb LoadError
Every time I tried to run rails server or bin/dev, it failed with the following error:
$ rails server
/Users/chris/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'Kernel.require': cannot load such file -- racc/parser.rb (LoadError)
from /Users/chris/.local/share/mise/installs/ruby/3.4.5/lib/ruby/3.4.0/bundled_gems.rb:82:in 'block (2 levels) in Kernel#replace_require'
etc......
No matter what I tried, I couldn't get the gem to install correctly.
I believe the root issue was a compatibility conflict — even though the racc gem appeared to install without errors, it wasn’t actually usable due to native extension issues on Apple Silicon.
To resolve this, I manually installed the gem with architecture-specific flags:
$ gem install racc -v 1.8.1 -- --with-cflags="-arch arm64"
** Edit
So after some chatting on the Rails forum, I got told that this can be sorted by adding:
gem "nokogiri", force_ruby_platform: !RUBY_PLATFORM.include?("arm64-darwin")
to the Gemfile and running bundle install
. I haven't tried this yet, but can't see any reason why it wouldn't work.
That fixed the cannot load such file -- racc/parser.rb
error on my M1 Mac.
Issue #2: Tailwindcss Ruby Executable Not Found
Next, I wanted to use Tailwind CSS in my app. I followed the installation steps from the Tailwind website. However, when I ran bin/dev
, it failed silently with an EXIT
code.
To dig deeper, I tried running the watcher directly:
$ rails tailwindcss:watch
That returned the following error:
Source locally installed gems is ignoring #<Bundler::StubSpecification name=racc version=1.8.1 platform=ruby> because it is missing extensions
bin/rails aborted!
Tailwindcss::Ruby::ExecutableNotFoundException: Cannot find the tailwindcss executable for arm64-darwin in /opt/homebrew/Cellar/tmuxinator/3.3.4/libexec/gems/tailwindcss-ruby-4.1.11/exe (Tailwindcss::Ruby::ExecutableNotFoundException)
The solution was to ensure that Bundler recognized the Apple Silicon architecture and that force_ruby_platform wasn’t preventing native gems from being installed correctly.
Here’s what I did:
Delete the force_ruby_platform
setting (if present):
$ bundle config --delete force_ruby_platform
You can check your current Bundler settings with:
$ bundle config
Add the correct platform to the lockfile and reset Tailwind:
$ bundle lock --add-platform arm64-darwin
$ bundle clean --force
$ bundle remove tailwindcss-rails
$ bundle add tailwindcss-rails
$ bundle install
After that, running:
$ rails tailwindcss:watch
finally worked, showing:
≈ tailwindcss v4.1.11
Done in 37ms
Final Setup
Running bin/dev
still failed for me, but I was able to use separate Tmux tabs to run the processes independently:
$ rails server
$ rails tailwindcss:watch
Wrapping Up
I hope this helps someone else running into similar issues with Rails and Tailwind CSS on Apple Silicon Macs. It took me a few hours of trial and error to piece this together — hopefully you can save some time!