DEV Community 👩‍💻👨‍💻

TJ Barber
TJ Barber

Posted on

Fixing "unable to monitor directories for changes" on Docker for macOS

Earlier today I ran across this error when trying to run my Docker-ized Ruby on Rails application:

FATAL: Listen error: unable to monitor directories for changes.

Obviously, I started Googling. I was confused, because I didn't know if this was my macOS host causing this issue or if it was the Docker container itself. Docker pointed me to this page which seemed like it should offer me the solution, and it kinda did but not really.

Through trial and error, I found that macOS doesn't have a sysctl.conf file by default. I wanted to avoid creating one if at all possible. But I found out that by using docker ssh I could get to my Docker container's terminal! Once I discovered that, here are the steps I took to resolve the issue:

  1. SSH into the container using docker ssh.
  2. Run the command provided by this page: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
  3. Run sudo sysctl -p to refresh your kernel parameters.

Re-run the command you were attempting to run and you should be good to go! From here I was able to start my Rails console and all worked as intended.

Top comments (0)

DEV runs on 100% open source code known as Forem.

Contribute to the codebase or host your own.
Check these out! 👇