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 fs.inotify.max_user_watches=524288

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.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.