Gulp spawn EMFILE error

for those who faced problem with gulp when watching a big number of files.

error might looks like this:


throw errnoException(process._errno, 'spawn');
Error: spawn EMFILE
at errnoException (child_process.js:988:11)
at ChildProcess.spawn (child_process.js:935:11)

here is a solution for you, the reason that caused this problem is by default mac is using 256 as default number of opening files, so set the limit to a large number will fix this problem

on your terminal

ulimit -S -n 2048 # or whatever number you choose

anyway if you are not familiar with Gulp, check out this page: