Outcome: You’ll raise Linux inotify watch limits so VS Code and other dev tools can monitor large projects without ENOSPC watcher errors.
Who this is for: Linux developers using VS Code, nodemon, webpack, or similar tools on big repos/monorepos.
Time required: About 1 minute.
Quick Answer
Increase fs.inotify.max_user_watches in /etc/sysctl.conf (or a sysctl drop-in), apply it with sudo sysctl -p, then restart VS Code. This removes the common “file watchers limit reached” bottleneck on large codebases.
Prerequisites
- Linux machine (Ubuntu, Fedora, Arch, etc.)
sudoaccess- A project that triggers file watcher errors (for example ENOSPC)
Step-by-step: Increase inotify watches for large projects
-
Check your current watcher limit.
Run:cat /proc/sys/fs/inotify/max_user_watchesExpected result: You see a number (often 8192 or 16384 on defaults).
-
Add a higher persistent limit.
Run:echo 'fs.inotify.max_user_watches=524288' | sudo tee -a /etc/sysctl.confExpected result: The new setting is appended to the file.
-
Apply the new kernel setting now.
Run:sudo sysctl -pExpected result: Terminal prints the updated inotify key/value.
-
Verify the new value.
Run:cat /proc/sys/fs/inotify/max_user_watchesExpected result: It now returns
524288(or your chosen higher value). -
Restart your editor/dev process.
Close and reopen VS Code (or reload window), then rerun your watcher-based tooling.Expected result: File watching and live reload work without watcher-limit errors.
Expected result checks
- VS Code no longer warns about file watcher limits in your large workspace.
- Live reload/hot reload tools detect file changes again.
cat /proc/sys/fs/inotify/max_user_watchesshows the higher value after reboot.
Common mistakes
- Using a temporary command only:
sudo sysctl fs.inotify.max_user_watches=...resets after reboot unless persisted. - Typos in key name: a misspelled
fs.inotify.max_user_watcheswon’t apply. - Forgetting to restart tools: existing editor sessions may keep old watcher state.
- Editing the wrong file: distro-specific sysctl drop-ins can override values.
Quick troubleshooting
- Value didn’t change: run
sudo sysctl -pagain and check for parse errors in output. - Still getting ENOSPC: raise further to
1048576if needed on very large monorepos. - Works until reboot: ensure the line exists in a persistent sysctl config file.
- WSL users: apply the setting inside your Linux distro environment, then restart that session.
Reference links
- ArchWiki: Increasing inotify watchers — https://wiki.archlinux.org/title/Inotify#Increasing_the_number_of_inotify_watchers
- Linux inotify manual (man7) — https://man7.org/linux/man-pages/man7/inotify.7.html
- sysctl manual (man7) — https://man7.org/linux/man-pages/man8/sysctl.8.html
- VS Code watcher-limit community reference — https://stackoverflow.com/questions/50901127/vsc-unable-to-watch-for-file-changes-in-this-large-workspace-weird
Related tech tricks
- Workflow Trick: Suspend and Resume Terminal Jobs in Linux (Ctrl+Z Magic)
- Chrome Speed Trick: Enable Parallel Downloading for Faster Big Files
- No-App Needed: Enable Windows Sandbox for Safe App Testing (Windows 11 Pro)
Next step
After this fix, clean up your workspace watcher load by excluding giant generated folders (like node_modules/.cache or build outputs) in your editor settings for even smoother performance.