· today i learned · 1 min read

How to fix 'Too many open files' error in RSpec & Capybara?

I will walk you through installing Ruby on Rails for development on macOS 10.15 Catalina (and later).

Errno::EMFILE: [..] Too many open files

       Failed to open TCP connection to (Too many open files - socket(2) for "" port 9515)

After running ulimit -Sn 10240 in bash, the underlying error becomes visible. For me, this was:

 Failure/Error: expect(page).to have_content 'Some text'
       expected to find text "Some text" in "Some other text"


  • rspec
  • ruby-on-rails
  • capybara

Related Posts

View All Posts »