Error: Unable to monitor directories for changes because iNotify max watches exceeded
Alexandre Calaça
Posted on September 20, 2024
Error
Unable to monitor directories for changes because iNotify max watches exceeded
Context
I got the error after using the following command
rails generate migration addCommentsToProducts
OUtput
Solution
As the error message says, in order to solve the issue of inotify max watches being exceeded on Ubuntu, we can increase the number of inotify watchers.
Open a terminal
check the current value of inotify watchers with:
cat /proc/sys/fs/inotify/max_user_watches
Output
Increase the number of watches
sudo sysctl fs.inotify.max_user_watches=524288
OUtput
Make the change permanent
echo 'fs.inotify.max_user_watches=524288' | sudo tee -a /etc/sysctl.conf
Output
Apply changes
sudo sysctl -p
Output
Try again
Now, you should be able to use the Rails generator or your command without encountering the inotify error.
Output
Done
💖 💪 🙅 🚩
Alexandre Calaça
Posted on September 20, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
ubuntu Error: Unable to monitor directories for changes because iNotify max watches exceeded
September 20, 2024