VSCode - Too many open files
If you are getting the too many open files error with macOS, it could be VSCode trying to open too many files (or opening more than 10,240 by default). You can confirm that with the following:
lsof | awk '{ print $2 " " $1; }' | sort -rn | uniq -c | sort -rn | head -20
So, what can you do about it? If the files are not important—say, your output folder—then you can use VSCode settings to exclude them. In the example below, I configure VSCode to ignore build folders. I’d encourage this as a workspace setting, so everyone on the team gets it:
// Configure glob patterns for excluding files and folders.
"files.exclude": {
"**/build": true
},
"files.watcherExclude": {
"**/build": true
},
"search.exclude": {
"**/build": true
}