← til

Stopping Spring from using 100% CPU

January 30, 2021
rails

I've noticed that running Spring often causes 100% CPU usage, which results in fans spinning out of control. I've shared the script that I use for killing these processes, but that is a band-aid solution.

Instead of just killing the processes, why not prevent it from happening in the first place?

To do that, remove the listen gem from the Gemfile:

gem "listen"
gem "spring-watcher-listen"

Since Rails' default file watcher depends on this gem, comment out this line in config/environments/development.rb:

# config.file_watcher = ActiveSupport::EventedFileUpdateChecker

This makes the fans much more silent.