Ubuntu change fs.inotify.max_user_watches for IDEA
When using IDEA (including PhpStorm, Clion etc.) I saw the warning for inotify is too low. Result in files are not updated in IDEA when I edit them in other editor like VSCode and Atom, while editing file in IDEA will have instant change in VSCode if that file does not have unsaved change in VSCode.
The official solution is the following link https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit which suggest the following code
sudo sysctl -w
It works, BUT after reboot, it goes back to the old small number. I also tried something similar from a wiki, which does not work either https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers
Finally, by editing the
/etc/sysctl.conf and adding the
fs.inotify.max_user_watches=524288 it works.
sudo echo “fs.inotify.max_user_watches=524288” >> /etc/sysctl.conf should also work if you don’t want to open the file and edit it.