VSCode - Too many open files

Submitted by Robert MacLean on Thu, 05/31/2018 - 22:56

If you are getting the too many open files error with MacOS it could be VSCode trying to too many open files (or by default opening more than 10240 files).

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 it is your output folder, then you can use VSCode settings to exclude them. In the example below, I configure VSCode to ignore build folders. I would encourage this as a workspace setting, so everyone in the team gets it.

  1. // Configure glob patterns for excluding files and folders.
  2.   "files.exclude": {
  3.     "**/build": true
  4.   },
  5.  
  6.   "files.watcherExclude": {
  7.     "**/build": true
  8.   },
  9.  
  10.   "search.exclude": {
  11.     "**/build": true
  12.   },