Yosemite Upgrade Changes Open File Limit | mact.me
文章目录
Yosemite Upgrade Changes Open File Limit | mact.me
Yosemite Upgrade Changes Open File Limit
OSX has a ridiculously low limit on the maximum number of open files. If you use OSX to develop Node applications – or even if you just use Node tools like grunt or gulp – you’ve no doubt run into this issue.
To address this, I have this line in my $HOME/.bash_profile:
ulimit 1000000 unlimited
And a corresponding entry in /etc/launchd.conf:
limit maxfiles 1000000
That solved the problem until I upgraded to OSX Yosemite, after which I began seeing the following error every time I opened a terminal window:
ulimit open files cannot modify limitInvalid argument
Luckily, I a little Google foo yielded this Superuser post (and answer).
So it was a quick fix:
$ echo kernmaxfiles65536 sudo tee sysctlconf
$ echo kernmaxfilesperproc65536 sudo tee sysctlconf
$ sudo sysctl w kernmaxfiles65536
$ sudo sysctl w kernmaxfilesperproc65536
$ ulimit 6553665536
Then I updated my $HOME/.bash_profile to change the ulimit directive to match that last command, above, and I was back in business.

