Is there a fix for the “Too many open files in system” error on OS X 10.7.1?











up vote
159
down vote

favorite
87












I need to get rid of the pesky "Too many open files in system" limit on OS X 10.7.1. 



Is there a way?










share|improve this question




















  • 4




    Do you want to explain more about when this happens? In which circumstances?
    – slhck
    Jun 7 '12 at 8:56






  • 1




    @slhck - I have the same problem. The circumstances are basically "at random." I'm a developer, so I'm using my Mac fairly heavily: running one or more databases, a web server, testing tools, one or more browsers, and a music player all at once. Google Chrome seems to be one program that has a lot of files open.
    – Nathan Long
    Jun 22 '12 at 18:25










  • Actually, my "heavy use" wasn't the issue; my settings for the maximum number of open files for the kernal and per-process were far lower than what the defaults should be.
    – Nathan Long
    Jun 29 '12 at 20:16






  • 2




    If your read Nathan's comment and wondered why he didn't include any details about the defaults, it's because he spelled it all out in his answer, below. (Nice answer! :)
    – Olie
    Jun 13 '13 at 18:06










  • I'm in the same usage circumstance as Nathan Long, and found restarting Apache was the only step that "solved" the problem. I applied all the below limit increases but they didn't help immediately. I am running command line phpUnit tests > selenium server > firefox > apache > php > mysql all on the same macbook. Used to work fine until I upgraded to mavericks. The error I get is in the webapp being tested, i.e. it's php/apache running out of files, so presumably not controlled by the shell setting.
    – scipilot
    Sep 19 '14 at 7:55















up vote
159
down vote

favorite
87












I need to get rid of the pesky "Too many open files in system" limit on OS X 10.7.1. 



Is there a way?










share|improve this question




















  • 4




    Do you want to explain more about when this happens? In which circumstances?
    – slhck
    Jun 7 '12 at 8:56






  • 1




    @slhck - I have the same problem. The circumstances are basically "at random." I'm a developer, so I'm using my Mac fairly heavily: running one or more databases, a web server, testing tools, one or more browsers, and a music player all at once. Google Chrome seems to be one program that has a lot of files open.
    – Nathan Long
    Jun 22 '12 at 18:25










  • Actually, my "heavy use" wasn't the issue; my settings for the maximum number of open files for the kernal and per-process were far lower than what the defaults should be.
    – Nathan Long
    Jun 29 '12 at 20:16






  • 2




    If your read Nathan's comment and wondered why he didn't include any details about the defaults, it's because he spelled it all out in his answer, below. (Nice answer! :)
    – Olie
    Jun 13 '13 at 18:06










  • I'm in the same usage circumstance as Nathan Long, and found restarting Apache was the only step that "solved" the problem. I applied all the below limit increases but they didn't help immediately. I am running command line phpUnit tests > selenium server > firefox > apache > php > mysql all on the same macbook. Used to work fine until I upgraded to mavericks. The error I get is in the webapp being tested, i.e. it's php/apache running out of files, so presumably not controlled by the shell setting.
    – scipilot
    Sep 19 '14 at 7:55













up vote
159
down vote

favorite
87









up vote
159
down vote

favorite
87






87





I need to get rid of the pesky "Too many open files in system" limit on OS X 10.7.1. 



Is there a way?










share|improve this question















I need to get rid of the pesky "Too many open files in system" limit on OS X 10.7.1. 



Is there a way?







macos






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 25 '14 at 12:42









Der Hochstapler

66.9k48230283




66.9k48230283










asked Jun 7 '12 at 8:52









John Wilund

799263




799263








  • 4




    Do you want to explain more about when this happens? In which circumstances?
    – slhck
    Jun 7 '12 at 8:56






  • 1




    @slhck - I have the same problem. The circumstances are basically "at random." I'm a developer, so I'm using my Mac fairly heavily: running one or more databases, a web server, testing tools, one or more browsers, and a music player all at once. Google Chrome seems to be one program that has a lot of files open.
    – Nathan Long
    Jun 22 '12 at 18:25










  • Actually, my "heavy use" wasn't the issue; my settings for the maximum number of open files for the kernal and per-process were far lower than what the defaults should be.
    – Nathan Long
    Jun 29 '12 at 20:16






  • 2




    If your read Nathan's comment and wondered why he didn't include any details about the defaults, it's because he spelled it all out in his answer, below. (Nice answer! :)
    – Olie
    Jun 13 '13 at 18:06










  • I'm in the same usage circumstance as Nathan Long, and found restarting Apache was the only step that "solved" the problem. I applied all the below limit increases but they didn't help immediately. I am running command line phpUnit tests > selenium server > firefox > apache > php > mysql all on the same macbook. Used to work fine until I upgraded to mavericks. The error I get is in the webapp being tested, i.e. it's php/apache running out of files, so presumably not controlled by the shell setting.
    – scipilot
    Sep 19 '14 at 7:55














  • 4




    Do you want to explain more about when this happens? In which circumstances?
    – slhck
    Jun 7 '12 at 8:56






  • 1




    @slhck - I have the same problem. The circumstances are basically "at random." I'm a developer, so I'm using my Mac fairly heavily: running one or more databases, a web server, testing tools, one or more browsers, and a music player all at once. Google Chrome seems to be one program that has a lot of files open.
    – Nathan Long
    Jun 22 '12 at 18:25










  • Actually, my "heavy use" wasn't the issue; my settings for the maximum number of open files for the kernal and per-process were far lower than what the defaults should be.
    – Nathan Long
    Jun 29 '12 at 20:16






  • 2




    If your read Nathan's comment and wondered why he didn't include any details about the defaults, it's because he spelled it all out in his answer, below. (Nice answer! :)
    – Olie
    Jun 13 '13 at 18:06










  • I'm in the same usage circumstance as Nathan Long, and found restarting Apache was the only step that "solved" the problem. I applied all the below limit increases but they didn't help immediately. I am running command line phpUnit tests > selenium server > firefox > apache > php > mysql all on the same macbook. Used to work fine until I upgraded to mavericks. The error I get is in the webapp being tested, i.e. it's php/apache running out of files, so presumably not controlled by the shell setting.
    – scipilot
    Sep 19 '14 at 7:55








4




4




Do you want to explain more about when this happens? In which circumstances?
– slhck
Jun 7 '12 at 8:56




Do you want to explain more about when this happens? In which circumstances?
– slhck
Jun 7 '12 at 8:56




1




1




@slhck - I have the same problem. The circumstances are basically "at random." I'm a developer, so I'm using my Mac fairly heavily: running one or more databases, a web server, testing tools, one or more browsers, and a music player all at once. Google Chrome seems to be one program that has a lot of files open.
– Nathan Long
Jun 22 '12 at 18:25




@slhck - I have the same problem. The circumstances are basically "at random." I'm a developer, so I'm using my Mac fairly heavily: running one or more databases, a web server, testing tools, one or more browsers, and a music player all at once. Google Chrome seems to be one program that has a lot of files open.
– Nathan Long
Jun 22 '12 at 18:25












Actually, my "heavy use" wasn't the issue; my settings for the maximum number of open files for the kernal and per-process were far lower than what the defaults should be.
– Nathan Long
Jun 29 '12 at 20:16




Actually, my "heavy use" wasn't the issue; my settings for the maximum number of open files for the kernal and per-process were far lower than what the defaults should be.
– Nathan Long
Jun 29 '12 at 20:16




2




2




If your read Nathan's comment and wondered why he didn't include any details about the defaults, it's because he spelled it all out in his answer, below. (Nice answer! :)
– Olie
Jun 13 '13 at 18:06




If your read Nathan's comment and wondered why he didn't include any details about the defaults, it's because he spelled it all out in his answer, below. (Nice answer! :)
– Olie
Jun 13 '13 at 18:06












I'm in the same usage circumstance as Nathan Long, and found restarting Apache was the only step that "solved" the problem. I applied all the below limit increases but they didn't help immediately. I am running command line phpUnit tests > selenium server > firefox > apache > php > mysql all on the same macbook. Used to work fine until I upgraded to mavericks. The error I get is in the webapp being tested, i.e. it's php/apache running out of files, so presumably not controlled by the shell setting.
– scipilot
Sep 19 '14 at 7:55




I'm in the same usage circumstance as Nathan Long, and found restarting Apache was the only step that "solved" the problem. I applied all the below limit increases but they didn't help immediately. I am running command line phpUnit tests > selenium server > firefox > apache > php > mysql all on the same macbook. Used to work fine until I upgraded to mavericks. The error I get is in the webapp being tested, i.e. it's php/apache running out of files, so presumably not controlled by the shell setting.
– scipilot
Sep 19 '14 at 7:55










8 Answers
8






active

oldest

votes

















up vote
205
down vote













According to this helpful article (which I recommend reading):




By default, the maximum number of files that Mac OS X can open is set
to 12,288 and the maximum number of files a given process can open is
10,240.




You can check these with:




  • sysctl kern.maxfiles

  • sysctl kern.maxfilesperproc


You can increase the limits (at your own risk) with:





  • sysctl -w kern.maxfiles=20480 (or whatever number you choose)


  • sysctl -w kern.maxfilesperproc=18000 (or whatever number you choose)


To make the change permanent, use sudo to put your settings in /etc/sysctl.conf (which you may have to create), like this:



kern.maxfiles=20480
kern.maxfilesperproc=18000


Note: In OS X 10.10 or lower, you can add setting in /etc/launchd.conf like limit maxfiles and it will override whatever you put here.



Again, from the article:




Once you’ve done this, the kernel itself will have a maximum number of
files but the shell might not. And since most processes that will take
up this many files are going to be initiated by the shell you’re
gonna want to increase that.




The command for that is:



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


That change is also temporary; it only lasts for the current shell session. You can add it to your shell configuration file (.bashrc, .zshrc or whatever) if you want it to run every time you open a shell.






share|improve this answer



















  • 1




    what limit applies to processes launched by clicking icons in the launch area? And how to change that limit? When you say "shell", I'm assuming you mean an interactive terminal shell.
    – Cheeso
    Aug 15 '12 at 0:48










  • @Cheeso - I think that the overall system limit (sysctl) or the launchd limit, whichever is lower, controls that.
    – Nathan Long
    Dec 14 '12 at 20:39






  • 1




    creating an /etc/launchd.conf with contents limit maxfiles 1000000 1000000 worked great for me! (OSX 10.8.2 here)
    – Zugwalt
    Feb 1 '13 at 19:26








  • 1




    I put kern.maxfiles=65000 kern.maxfilesperproc=65000 in /etc/sysctl.conf and rebooted. kern.maxfiles was ignored and stayed the default but kern.maxfilesperproc was set to 65000. I have no /etc/launchd.conf so what's up with that?
    – pferrel
    Nov 13 '14 at 0:47






  • 1




    If anyone has problems with max files not sticking, it is because there is a trailing space after the maxfiles line, that needs to be deleted.
    – jjathman
    Oct 14 '16 at 16:27


















up vote
53
down vote













It seems like there is an entirely different method for changing the open files limit for each version of OS X!



For OS X Sierra (10.12.X) you need to:



1.
Create a file at /Library/LaunchDaemons/limit.maxfiles.plist and paste the following in (feel free to change the two numbers (which are the soft and hard limits, respectively):



<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>64000</string>
<string>524288</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>


2.
Change the owner of your new file:



sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist


3.
Load these new settings:



sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist


4.
Finally, check that the limits are correct:



launchctl limit maxfiles





share|improve this answer























  • worked perfectly, thanks! In my case the error manifested in a java process with the message IO Error: Bad file descriptor (Write failed)
    – agradl
    Mar 22 '17 at 16:52






  • 1




    Also works on El Capitan 10.11.6
    – Troy Daniels
    Apr 17 '17 at 17:23










  • still cannot change the ulimit for shell. The maximum stays 1024 whatever I do
    – DataGreed
    Oct 6 '17 at 0:46










  • At step 2 run: sudo chmod 600 /Library/LaunchDaemons/limit.maxfiles.plist sudo chown root /Library/LaunchDaemons/limit.maxfiles.plist
    – Hai Nguyen
    Jun 21 at 8:00


















up vote
29
down vote













You will need to increase your ulimit settings - it's pretty low on OS X these days - 256 by default. Add ulimit -n 4096 or similar to your ~/.profile or equivalent and that will solve it in your local environment. Run ulimit -a to check your current levels



To see the system settings, run this:



launchctl limit maxfiles


It is set quite a bit higher in Lion (10240) on a per process basis than it used to be. But if you are still hitting it there then you can set it higher using the same command with the desired levels. To make the changes permanent /etc/launchd.conf is where you need to add the relevant lines.






share|improve this answer

















  • 1




    256? It's 2560 file descriptors for me and I've never changed it. The limit is 266 processes (c.f. ulimit -a).
    – slhck
    Jun 22 '12 at 18:55






  • 2




    Same for me, 256 files on MacOS X Maverick
    – Climbatize
    Aug 9 '14 at 6:44






  • 4




    256 on OS X Yosemite as well
    – Alexander
    May 28 '15 at 9:52






  • 2




    256 on El Capitan, too.
    – TMN
    Apr 28 '16 at 10:53






  • 1




    256 in Yosemite.
    – Jaec
    Jun 16 '16 at 22:50


















up vote
21
down vote













Other option may be finding the culprit:



sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail


For the last one you could see what files are open:



sudo lsof -n | grep socketfil


And kill the process if so desired



kill $pid




From the comments:




For what it's worth, you can also get a list of the process IDs with the most open files using



lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail






share|improve this answer























  • Helpful! But sort on OS X (10.11) doesn't take -h. (Maybe -g?)
    – Robert Calhoun
    Mar 3 '17 at 14:52










  • For me worked well just without -h (OS X 10.12.3): sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail
    – vearutop
    Mar 6 '17 at 3:42










  • So be it without -h
    – sanmai
    Mar 6 '17 at 10:27










  • This is the only answer that helped me to root cause my issue.. thanks :)
    – SgtPooki
    Mar 11 '17 at 10:46










  • For what it's worth, you can also get a list of the process IDs with the most open files using lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail.
    – Chris Frederick
    May 12 '17 at 4:52


















up vote
9
down vote













Folks, on Mavericks 10.9.4



ulimit -n 2048 works fine. You may need to launch a new login session.






share|improve this answer




























    up vote
    1
    down vote













    You can run



    lsof -n


    which process open too many files.



    then kill it .



    or



    sysctl -w kern.maxfiles=20480


    change it to bigger one.






    share|improve this answer

















    • 2




      Please explain how this answer differs from the ones already given.
      – Stephen Rauch
      May 18 '17 at 3:30


















    up vote
    0
    down vote













    I encountered it while doing a chmod -R so I got it around by taking smaller steps, e.g.



    # for each directory
    find . -type d -exec chmod 755 {} ;





    share|improve this answer

















    • 1




      While this may be a work-around, it doesn't appear to actually answer the question. Perhaps explaining that you cannot get rid of the message and then proposing this as one way to make it less of an issue would improve your answer.
      – music2myear
      Jan 4 '17 at 21:11


















    up vote
    0
    down vote













    For latest macOS (at the time of writing: 10.14.1), you can use sudo launchctl limit maxfiles 64000 524288 (by default it was 256), but it works only within current session. Use launchctl job from @ninjaPixel (https://superuser.com/a/1171028/760235) for permanent solution.






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f433746%2fis-there-a-fix-for-the-too-many-open-files-in-system-error-on-os-x-10-7-1%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      8 Answers
      8






      active

      oldest

      votes








      8 Answers
      8






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      205
      down vote













      According to this helpful article (which I recommend reading):




      By default, the maximum number of files that Mac OS X can open is set
      to 12,288 and the maximum number of files a given process can open is
      10,240.




      You can check these with:




      • sysctl kern.maxfiles

      • sysctl kern.maxfilesperproc


      You can increase the limits (at your own risk) with:





      • sysctl -w kern.maxfiles=20480 (or whatever number you choose)


      • sysctl -w kern.maxfilesperproc=18000 (or whatever number you choose)


      To make the change permanent, use sudo to put your settings in /etc/sysctl.conf (which you may have to create), like this:



      kern.maxfiles=20480
      kern.maxfilesperproc=18000


      Note: In OS X 10.10 or lower, you can add setting in /etc/launchd.conf like limit maxfiles and it will override whatever you put here.



      Again, from the article:




      Once you’ve done this, the kernel itself will have a maximum number of
      files but the shell might not. And since most processes that will take
      up this many files are going to be initiated by the shell you’re
      gonna want to increase that.




      The command for that is:



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


      That change is also temporary; it only lasts for the current shell session. You can add it to your shell configuration file (.bashrc, .zshrc or whatever) if you want it to run every time you open a shell.






      share|improve this answer



















      • 1




        what limit applies to processes launched by clicking icons in the launch area? And how to change that limit? When you say "shell", I'm assuming you mean an interactive terminal shell.
        – Cheeso
        Aug 15 '12 at 0:48










      • @Cheeso - I think that the overall system limit (sysctl) or the launchd limit, whichever is lower, controls that.
        – Nathan Long
        Dec 14 '12 at 20:39






      • 1




        creating an /etc/launchd.conf with contents limit maxfiles 1000000 1000000 worked great for me! (OSX 10.8.2 here)
        – Zugwalt
        Feb 1 '13 at 19:26








      • 1




        I put kern.maxfiles=65000 kern.maxfilesperproc=65000 in /etc/sysctl.conf and rebooted. kern.maxfiles was ignored and stayed the default but kern.maxfilesperproc was set to 65000. I have no /etc/launchd.conf so what's up with that?
        – pferrel
        Nov 13 '14 at 0:47






      • 1




        If anyone has problems with max files not sticking, it is because there is a trailing space after the maxfiles line, that needs to be deleted.
        – jjathman
        Oct 14 '16 at 16:27















      up vote
      205
      down vote













      According to this helpful article (which I recommend reading):




      By default, the maximum number of files that Mac OS X can open is set
      to 12,288 and the maximum number of files a given process can open is
      10,240.




      You can check these with:




      • sysctl kern.maxfiles

      • sysctl kern.maxfilesperproc


      You can increase the limits (at your own risk) with:





      • sysctl -w kern.maxfiles=20480 (or whatever number you choose)


      • sysctl -w kern.maxfilesperproc=18000 (or whatever number you choose)


      To make the change permanent, use sudo to put your settings in /etc/sysctl.conf (which you may have to create), like this:



      kern.maxfiles=20480
      kern.maxfilesperproc=18000


      Note: In OS X 10.10 or lower, you can add setting in /etc/launchd.conf like limit maxfiles and it will override whatever you put here.



      Again, from the article:




      Once you’ve done this, the kernel itself will have a maximum number of
      files but the shell might not. And since most processes that will take
      up this many files are going to be initiated by the shell you’re
      gonna want to increase that.




      The command for that is:



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


      That change is also temporary; it only lasts for the current shell session. You can add it to your shell configuration file (.bashrc, .zshrc or whatever) if you want it to run every time you open a shell.






      share|improve this answer



















      • 1




        what limit applies to processes launched by clicking icons in the launch area? And how to change that limit? When you say "shell", I'm assuming you mean an interactive terminal shell.
        – Cheeso
        Aug 15 '12 at 0:48










      • @Cheeso - I think that the overall system limit (sysctl) or the launchd limit, whichever is lower, controls that.
        – Nathan Long
        Dec 14 '12 at 20:39






      • 1




        creating an /etc/launchd.conf with contents limit maxfiles 1000000 1000000 worked great for me! (OSX 10.8.2 here)
        – Zugwalt
        Feb 1 '13 at 19:26








      • 1




        I put kern.maxfiles=65000 kern.maxfilesperproc=65000 in /etc/sysctl.conf and rebooted. kern.maxfiles was ignored and stayed the default but kern.maxfilesperproc was set to 65000. I have no /etc/launchd.conf so what's up with that?
        – pferrel
        Nov 13 '14 at 0:47






      • 1




        If anyone has problems with max files not sticking, it is because there is a trailing space after the maxfiles line, that needs to be deleted.
        – jjathman
        Oct 14 '16 at 16:27













      up vote
      205
      down vote










      up vote
      205
      down vote









      According to this helpful article (which I recommend reading):




      By default, the maximum number of files that Mac OS X can open is set
      to 12,288 and the maximum number of files a given process can open is
      10,240.




      You can check these with:




      • sysctl kern.maxfiles

      • sysctl kern.maxfilesperproc


      You can increase the limits (at your own risk) with:





      • sysctl -w kern.maxfiles=20480 (or whatever number you choose)


      • sysctl -w kern.maxfilesperproc=18000 (or whatever number you choose)


      To make the change permanent, use sudo to put your settings in /etc/sysctl.conf (which you may have to create), like this:



      kern.maxfiles=20480
      kern.maxfilesperproc=18000


      Note: In OS X 10.10 or lower, you can add setting in /etc/launchd.conf like limit maxfiles and it will override whatever you put here.



      Again, from the article:




      Once you’ve done this, the kernel itself will have a maximum number of
      files but the shell might not. And since most processes that will take
      up this many files are going to be initiated by the shell you’re
      gonna want to increase that.




      The command for that is:



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


      That change is also temporary; it only lasts for the current shell session. You can add it to your shell configuration file (.bashrc, .zshrc or whatever) if you want it to run every time you open a shell.






      share|improve this answer














      According to this helpful article (which I recommend reading):




      By default, the maximum number of files that Mac OS X can open is set
      to 12,288 and the maximum number of files a given process can open is
      10,240.




      You can check these with:




      • sysctl kern.maxfiles

      • sysctl kern.maxfilesperproc


      You can increase the limits (at your own risk) with:





      • sysctl -w kern.maxfiles=20480 (or whatever number you choose)


      • sysctl -w kern.maxfilesperproc=18000 (or whatever number you choose)


      To make the change permanent, use sudo to put your settings in /etc/sysctl.conf (which you may have to create), like this:



      kern.maxfiles=20480
      kern.maxfilesperproc=18000


      Note: In OS X 10.10 or lower, you can add setting in /etc/launchd.conf like limit maxfiles and it will override whatever you put here.



      Again, from the article:




      Once you’ve done this, the kernel itself will have a maximum number of
      files but the shell might not. And since most processes that will take
      up this many files are going to be initiated by the shell you’re
      gonna want to increase that.




      The command for that is:



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


      That change is also temporary; it only lasts for the current shell session. You can add it to your shell configuration file (.bashrc, .zshrc or whatever) if you want it to run every time you open a shell.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Oct 5 '17 at 12:40









      kenorb

      10.5k1576108




      10.5k1576108










      answered Jun 29 '12 at 20:23









      Nathan Long

      10.8k2880124




      10.8k2880124








      • 1




        what limit applies to processes launched by clicking icons in the launch area? And how to change that limit? When you say "shell", I'm assuming you mean an interactive terminal shell.
        – Cheeso
        Aug 15 '12 at 0:48










      • @Cheeso - I think that the overall system limit (sysctl) or the launchd limit, whichever is lower, controls that.
        – Nathan Long
        Dec 14 '12 at 20:39






      • 1




        creating an /etc/launchd.conf with contents limit maxfiles 1000000 1000000 worked great for me! (OSX 10.8.2 here)
        – Zugwalt
        Feb 1 '13 at 19:26








      • 1




        I put kern.maxfiles=65000 kern.maxfilesperproc=65000 in /etc/sysctl.conf and rebooted. kern.maxfiles was ignored and stayed the default but kern.maxfilesperproc was set to 65000. I have no /etc/launchd.conf so what's up with that?
        – pferrel
        Nov 13 '14 at 0:47






      • 1




        If anyone has problems with max files not sticking, it is because there is a trailing space after the maxfiles line, that needs to be deleted.
        – jjathman
        Oct 14 '16 at 16:27














      • 1




        what limit applies to processes launched by clicking icons in the launch area? And how to change that limit? When you say "shell", I'm assuming you mean an interactive terminal shell.
        – Cheeso
        Aug 15 '12 at 0:48










      • @Cheeso - I think that the overall system limit (sysctl) or the launchd limit, whichever is lower, controls that.
        – Nathan Long
        Dec 14 '12 at 20:39






      • 1




        creating an /etc/launchd.conf with contents limit maxfiles 1000000 1000000 worked great for me! (OSX 10.8.2 here)
        – Zugwalt
        Feb 1 '13 at 19:26








      • 1




        I put kern.maxfiles=65000 kern.maxfilesperproc=65000 in /etc/sysctl.conf and rebooted. kern.maxfiles was ignored and stayed the default but kern.maxfilesperproc was set to 65000. I have no /etc/launchd.conf so what's up with that?
        – pferrel
        Nov 13 '14 at 0:47






      • 1




        If anyone has problems with max files not sticking, it is because there is a trailing space after the maxfiles line, that needs to be deleted.
        – jjathman
        Oct 14 '16 at 16:27








      1




      1




      what limit applies to processes launched by clicking icons in the launch area? And how to change that limit? When you say "shell", I'm assuming you mean an interactive terminal shell.
      – Cheeso
      Aug 15 '12 at 0:48




      what limit applies to processes launched by clicking icons in the launch area? And how to change that limit? When you say "shell", I'm assuming you mean an interactive terminal shell.
      – Cheeso
      Aug 15 '12 at 0:48












      @Cheeso - I think that the overall system limit (sysctl) or the launchd limit, whichever is lower, controls that.
      – Nathan Long
      Dec 14 '12 at 20:39




      @Cheeso - I think that the overall system limit (sysctl) or the launchd limit, whichever is lower, controls that.
      – Nathan Long
      Dec 14 '12 at 20:39




      1




      1




      creating an /etc/launchd.conf with contents limit maxfiles 1000000 1000000 worked great for me! (OSX 10.8.2 here)
      – Zugwalt
      Feb 1 '13 at 19:26






      creating an /etc/launchd.conf with contents limit maxfiles 1000000 1000000 worked great for me! (OSX 10.8.2 here)
      – Zugwalt
      Feb 1 '13 at 19:26






      1




      1




      I put kern.maxfiles=65000 kern.maxfilesperproc=65000 in /etc/sysctl.conf and rebooted. kern.maxfiles was ignored and stayed the default but kern.maxfilesperproc was set to 65000. I have no /etc/launchd.conf so what's up with that?
      – pferrel
      Nov 13 '14 at 0:47




      I put kern.maxfiles=65000 kern.maxfilesperproc=65000 in /etc/sysctl.conf and rebooted. kern.maxfiles was ignored and stayed the default but kern.maxfilesperproc was set to 65000. I have no /etc/launchd.conf so what's up with that?
      – pferrel
      Nov 13 '14 at 0:47




      1




      1




      If anyone has problems with max files not sticking, it is because there is a trailing space after the maxfiles line, that needs to be deleted.
      – jjathman
      Oct 14 '16 at 16:27




      If anyone has problems with max files not sticking, it is because there is a trailing space after the maxfiles line, that needs to be deleted.
      – jjathman
      Oct 14 '16 at 16:27












      up vote
      53
      down vote













      It seems like there is an entirely different method for changing the open files limit for each version of OS X!



      For OS X Sierra (10.12.X) you need to:



      1.
      Create a file at /Library/LaunchDaemons/limit.maxfiles.plist and paste the following in (feel free to change the two numbers (which are the soft and hard limits, respectively):



      <?xml version="1.0" encoding="UTF-8"?>  
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
      "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
      <key>Label</key>
      <string>limit.maxfiles</string>
      <key>ProgramArguments</key>
      <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>64000</string>
      <string>524288</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
      <key>ServiceIPC</key>
      <false/>
      </dict>
      </plist>


      2.
      Change the owner of your new file:



      sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist


      3.
      Load these new settings:



      sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist


      4.
      Finally, check that the limits are correct:



      launchctl limit maxfiles





      share|improve this answer























      • worked perfectly, thanks! In my case the error manifested in a java process with the message IO Error: Bad file descriptor (Write failed)
        – agradl
        Mar 22 '17 at 16:52






      • 1




        Also works on El Capitan 10.11.6
        – Troy Daniels
        Apr 17 '17 at 17:23










      • still cannot change the ulimit for shell. The maximum stays 1024 whatever I do
        – DataGreed
        Oct 6 '17 at 0:46










      • At step 2 run: sudo chmod 600 /Library/LaunchDaemons/limit.maxfiles.plist sudo chown root /Library/LaunchDaemons/limit.maxfiles.plist
        – Hai Nguyen
        Jun 21 at 8:00















      up vote
      53
      down vote













      It seems like there is an entirely different method for changing the open files limit for each version of OS X!



      For OS X Sierra (10.12.X) you need to:



      1.
      Create a file at /Library/LaunchDaemons/limit.maxfiles.plist and paste the following in (feel free to change the two numbers (which are the soft and hard limits, respectively):



      <?xml version="1.0" encoding="UTF-8"?>  
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
      "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
      <key>Label</key>
      <string>limit.maxfiles</string>
      <key>ProgramArguments</key>
      <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>64000</string>
      <string>524288</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
      <key>ServiceIPC</key>
      <false/>
      </dict>
      </plist>


      2.
      Change the owner of your new file:



      sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist


      3.
      Load these new settings:



      sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist


      4.
      Finally, check that the limits are correct:



      launchctl limit maxfiles





      share|improve this answer























      • worked perfectly, thanks! In my case the error manifested in a java process with the message IO Error: Bad file descriptor (Write failed)
        – agradl
        Mar 22 '17 at 16:52






      • 1




        Also works on El Capitan 10.11.6
        – Troy Daniels
        Apr 17 '17 at 17:23










      • still cannot change the ulimit for shell. The maximum stays 1024 whatever I do
        – DataGreed
        Oct 6 '17 at 0:46










      • At step 2 run: sudo chmod 600 /Library/LaunchDaemons/limit.maxfiles.plist sudo chown root /Library/LaunchDaemons/limit.maxfiles.plist
        – Hai Nguyen
        Jun 21 at 8:00













      up vote
      53
      down vote










      up vote
      53
      down vote









      It seems like there is an entirely different method for changing the open files limit for each version of OS X!



      For OS X Sierra (10.12.X) you need to:



      1.
      Create a file at /Library/LaunchDaemons/limit.maxfiles.plist and paste the following in (feel free to change the two numbers (which are the soft and hard limits, respectively):



      <?xml version="1.0" encoding="UTF-8"?>  
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
      "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
      <key>Label</key>
      <string>limit.maxfiles</string>
      <key>ProgramArguments</key>
      <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>64000</string>
      <string>524288</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
      <key>ServiceIPC</key>
      <false/>
      </dict>
      </plist>


      2.
      Change the owner of your new file:



      sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist


      3.
      Load these new settings:



      sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist


      4.
      Finally, check that the limits are correct:



      launchctl limit maxfiles





      share|improve this answer














      It seems like there is an entirely different method for changing the open files limit for each version of OS X!



      For OS X Sierra (10.12.X) you need to:



      1.
      Create a file at /Library/LaunchDaemons/limit.maxfiles.plist and paste the following in (feel free to change the two numbers (which are the soft and hard limits, respectively):



      <?xml version="1.0" encoding="UTF-8"?>  
      <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
      "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
      <key>Label</key>
      <string>limit.maxfiles</string>
      <key>ProgramArguments</key>
      <array>
      <string>launchctl</string>
      <string>limit</string>
      <string>maxfiles</string>
      <string>64000</string>
      <string>524288</string>
      </array>
      <key>RunAtLoad</key>
      <true/>
      <key>ServiceIPC</key>
      <false/>
      </dict>
      </plist>


      2.
      Change the owner of your new file:



      sudo chown root:wheel /Library/LaunchDaemons/limit.maxfiles.plist


      3.
      Load these new settings:



      sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist


      4.
      Finally, check that the limits are correct:



      launchctl limit maxfiles






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited May 15 '17 at 23:43









      Kyle Falconer

      1177




      1177










      answered Jan 24 '17 at 14:56









      ninjaPixel

      1,131108




      1,131108












      • worked perfectly, thanks! In my case the error manifested in a java process with the message IO Error: Bad file descriptor (Write failed)
        – agradl
        Mar 22 '17 at 16:52






      • 1




        Also works on El Capitan 10.11.6
        – Troy Daniels
        Apr 17 '17 at 17:23










      • still cannot change the ulimit for shell. The maximum stays 1024 whatever I do
        – DataGreed
        Oct 6 '17 at 0:46










      • At step 2 run: sudo chmod 600 /Library/LaunchDaemons/limit.maxfiles.plist sudo chown root /Library/LaunchDaemons/limit.maxfiles.plist
        – Hai Nguyen
        Jun 21 at 8:00


















      • worked perfectly, thanks! In my case the error manifested in a java process with the message IO Error: Bad file descriptor (Write failed)
        – agradl
        Mar 22 '17 at 16:52






      • 1




        Also works on El Capitan 10.11.6
        – Troy Daniels
        Apr 17 '17 at 17:23










      • still cannot change the ulimit for shell. The maximum stays 1024 whatever I do
        – DataGreed
        Oct 6 '17 at 0:46










      • At step 2 run: sudo chmod 600 /Library/LaunchDaemons/limit.maxfiles.plist sudo chown root /Library/LaunchDaemons/limit.maxfiles.plist
        – Hai Nguyen
        Jun 21 at 8:00
















      worked perfectly, thanks! In my case the error manifested in a java process with the message IO Error: Bad file descriptor (Write failed)
      – agradl
      Mar 22 '17 at 16:52




      worked perfectly, thanks! In my case the error manifested in a java process with the message IO Error: Bad file descriptor (Write failed)
      – agradl
      Mar 22 '17 at 16:52




      1




      1




      Also works on El Capitan 10.11.6
      – Troy Daniels
      Apr 17 '17 at 17:23




      Also works on El Capitan 10.11.6
      – Troy Daniels
      Apr 17 '17 at 17:23












      still cannot change the ulimit for shell. The maximum stays 1024 whatever I do
      – DataGreed
      Oct 6 '17 at 0:46




      still cannot change the ulimit for shell. The maximum stays 1024 whatever I do
      – DataGreed
      Oct 6 '17 at 0:46












      At step 2 run: sudo chmod 600 /Library/LaunchDaemons/limit.maxfiles.plist sudo chown root /Library/LaunchDaemons/limit.maxfiles.plist
      – Hai Nguyen
      Jun 21 at 8:00




      At step 2 run: sudo chmod 600 /Library/LaunchDaemons/limit.maxfiles.plist sudo chown root /Library/LaunchDaemons/limit.maxfiles.plist
      – Hai Nguyen
      Jun 21 at 8:00










      up vote
      29
      down vote













      You will need to increase your ulimit settings - it's pretty low on OS X these days - 256 by default. Add ulimit -n 4096 or similar to your ~/.profile or equivalent and that will solve it in your local environment. Run ulimit -a to check your current levels



      To see the system settings, run this:



      launchctl limit maxfiles


      It is set quite a bit higher in Lion (10240) on a per process basis than it used to be. But if you are still hitting it there then you can set it higher using the same command with the desired levels. To make the changes permanent /etc/launchd.conf is where you need to add the relevant lines.






      share|improve this answer

















      • 1




        256? It's 2560 file descriptors for me and I've never changed it. The limit is 266 processes (c.f. ulimit -a).
        – slhck
        Jun 22 '12 at 18:55






      • 2




        Same for me, 256 files on MacOS X Maverick
        – Climbatize
        Aug 9 '14 at 6:44






      • 4




        256 on OS X Yosemite as well
        – Alexander
        May 28 '15 at 9:52






      • 2




        256 on El Capitan, too.
        – TMN
        Apr 28 '16 at 10:53






      • 1




        256 in Yosemite.
        – Jaec
        Jun 16 '16 at 22:50















      up vote
      29
      down vote













      You will need to increase your ulimit settings - it's pretty low on OS X these days - 256 by default. Add ulimit -n 4096 or similar to your ~/.profile or equivalent and that will solve it in your local environment. Run ulimit -a to check your current levels



      To see the system settings, run this:



      launchctl limit maxfiles


      It is set quite a bit higher in Lion (10240) on a per process basis than it used to be. But if you are still hitting it there then you can set it higher using the same command with the desired levels. To make the changes permanent /etc/launchd.conf is where you need to add the relevant lines.






      share|improve this answer

















      • 1




        256? It's 2560 file descriptors for me and I've never changed it. The limit is 266 processes (c.f. ulimit -a).
        – slhck
        Jun 22 '12 at 18:55






      • 2




        Same for me, 256 files on MacOS X Maverick
        – Climbatize
        Aug 9 '14 at 6:44






      • 4




        256 on OS X Yosemite as well
        – Alexander
        May 28 '15 at 9:52






      • 2




        256 on El Capitan, too.
        – TMN
        Apr 28 '16 at 10:53






      • 1




        256 in Yosemite.
        – Jaec
        Jun 16 '16 at 22:50













      up vote
      29
      down vote










      up vote
      29
      down vote









      You will need to increase your ulimit settings - it's pretty low on OS X these days - 256 by default. Add ulimit -n 4096 or similar to your ~/.profile or equivalent and that will solve it in your local environment. Run ulimit -a to check your current levels



      To see the system settings, run this:



      launchctl limit maxfiles


      It is set quite a bit higher in Lion (10240) on a per process basis than it used to be. But if you are still hitting it there then you can set it higher using the same command with the desired levels. To make the changes permanent /etc/launchd.conf is where you need to add the relevant lines.






      share|improve this answer












      You will need to increase your ulimit settings - it's pretty low on OS X these days - 256 by default. Add ulimit -n 4096 or similar to your ~/.profile or equivalent and that will solve it in your local environment. Run ulimit -a to check your current levels



      To see the system settings, run this:



      launchctl limit maxfiles


      It is set quite a bit higher in Lion (10240) on a per process basis than it used to be. But if you are still hitting it there then you can set it higher using the same command with the desired levels. To make the changes permanent /etc/launchd.conf is where you need to add the relevant lines.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jun 7 '12 at 11:09









      Adam C

      2,2401425




      2,2401425








      • 1




        256? It's 2560 file descriptors for me and I've never changed it. The limit is 266 processes (c.f. ulimit -a).
        – slhck
        Jun 22 '12 at 18:55






      • 2




        Same for me, 256 files on MacOS X Maverick
        – Climbatize
        Aug 9 '14 at 6:44






      • 4




        256 on OS X Yosemite as well
        – Alexander
        May 28 '15 at 9:52






      • 2




        256 on El Capitan, too.
        – TMN
        Apr 28 '16 at 10:53






      • 1




        256 in Yosemite.
        – Jaec
        Jun 16 '16 at 22:50














      • 1




        256? It's 2560 file descriptors for me and I've never changed it. The limit is 266 processes (c.f. ulimit -a).
        – slhck
        Jun 22 '12 at 18:55






      • 2




        Same for me, 256 files on MacOS X Maverick
        – Climbatize
        Aug 9 '14 at 6:44






      • 4




        256 on OS X Yosemite as well
        – Alexander
        May 28 '15 at 9:52






      • 2




        256 on El Capitan, too.
        – TMN
        Apr 28 '16 at 10:53






      • 1




        256 in Yosemite.
        – Jaec
        Jun 16 '16 at 22:50








      1




      1




      256? It's 2560 file descriptors for me and I've never changed it. The limit is 266 processes (c.f. ulimit -a).
      – slhck
      Jun 22 '12 at 18:55




      256? It's 2560 file descriptors for me and I've never changed it. The limit is 266 processes (c.f. ulimit -a).
      – slhck
      Jun 22 '12 at 18:55




      2




      2




      Same for me, 256 files on MacOS X Maverick
      – Climbatize
      Aug 9 '14 at 6:44




      Same for me, 256 files on MacOS X Maverick
      – Climbatize
      Aug 9 '14 at 6:44




      4




      4




      256 on OS X Yosemite as well
      – Alexander
      May 28 '15 at 9:52




      256 on OS X Yosemite as well
      – Alexander
      May 28 '15 at 9:52




      2




      2




      256 on El Capitan, too.
      – TMN
      Apr 28 '16 at 10:53




      256 on El Capitan, too.
      – TMN
      Apr 28 '16 at 10:53




      1




      1




      256 in Yosemite.
      – Jaec
      Jun 16 '16 at 22:50




      256 in Yosemite.
      – Jaec
      Jun 16 '16 at 22:50










      up vote
      21
      down vote













      Other option may be finding the culprit:



      sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail


      For the last one you could see what files are open:



      sudo lsof -n | grep socketfil


      And kill the process if so desired



      kill $pid




      From the comments:




      For what it's worth, you can also get a list of the process IDs with the most open files using



      lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail






      share|improve this answer























      • Helpful! But sort on OS X (10.11) doesn't take -h. (Maybe -g?)
        – Robert Calhoun
        Mar 3 '17 at 14:52










      • For me worked well just without -h (OS X 10.12.3): sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail
        – vearutop
        Mar 6 '17 at 3:42










      • So be it without -h
        – sanmai
        Mar 6 '17 at 10:27










      • This is the only answer that helped me to root cause my issue.. thanks :)
        – SgtPooki
        Mar 11 '17 at 10:46










      • For what it's worth, you can also get a list of the process IDs with the most open files using lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail.
        – Chris Frederick
        May 12 '17 at 4:52















      up vote
      21
      down vote













      Other option may be finding the culprit:



      sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail


      For the last one you could see what files are open:



      sudo lsof -n | grep socketfil


      And kill the process if so desired



      kill $pid




      From the comments:




      For what it's worth, you can also get a list of the process IDs with the most open files using



      lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail






      share|improve this answer























      • Helpful! But sort on OS X (10.11) doesn't take -h. (Maybe -g?)
        – Robert Calhoun
        Mar 3 '17 at 14:52










      • For me worked well just without -h (OS X 10.12.3): sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail
        – vearutop
        Mar 6 '17 at 3:42










      • So be it without -h
        – sanmai
        Mar 6 '17 at 10:27










      • This is the only answer that helped me to root cause my issue.. thanks :)
        – SgtPooki
        Mar 11 '17 at 10:46










      • For what it's worth, you can also get a list of the process IDs with the most open files using lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail.
        – Chris Frederick
        May 12 '17 at 4:52













      up vote
      21
      down vote










      up vote
      21
      down vote









      Other option may be finding the culprit:



      sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail


      For the last one you could see what files are open:



      sudo lsof -n | grep socketfil


      And kill the process if so desired



      kill $pid




      From the comments:




      For what it's worth, you can also get a list of the process IDs with the most open files using



      lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail






      share|improve this answer














      Other option may be finding the culprit:



      sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail


      For the last one you could see what files are open:



      sudo lsof -n | grep socketfil


      And kill the process if so desired



      kill $pid




      From the comments:




      For what it's worth, you can also get a list of the process IDs with the most open files using



      lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Dec 27 '17 at 1:46

























      answered Feb 18 '17 at 0:42









      sanmai

      407412




      407412












      • Helpful! But sort on OS X (10.11) doesn't take -h. (Maybe -g?)
        – Robert Calhoun
        Mar 3 '17 at 14:52










      • For me worked well just without -h (OS X 10.12.3): sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail
        – vearutop
        Mar 6 '17 at 3:42










      • So be it without -h
        – sanmai
        Mar 6 '17 at 10:27










      • This is the only answer that helped me to root cause my issue.. thanks :)
        – SgtPooki
        Mar 11 '17 at 10:46










      • For what it's worth, you can also get a list of the process IDs with the most open files using lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail.
        – Chris Frederick
        May 12 '17 at 4:52


















      • Helpful! But sort on OS X (10.11) doesn't take -h. (Maybe -g?)
        – Robert Calhoun
        Mar 3 '17 at 14:52










      • For me worked well just without -h (OS X 10.12.3): sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail
        – vearutop
        Mar 6 '17 at 3:42










      • So be it without -h
        – sanmai
        Mar 6 '17 at 10:27










      • This is the only answer that helped me to root cause my issue.. thanks :)
        – SgtPooki
        Mar 11 '17 at 10:46










      • For what it's worth, you can also get a list of the process IDs with the most open files using lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail.
        – Chris Frederick
        May 12 '17 at 4:52
















      Helpful! But sort on OS X (10.11) doesn't take -h. (Maybe -g?)
      – Robert Calhoun
      Mar 3 '17 at 14:52




      Helpful! But sort on OS X (10.11) doesn't take -h. (Maybe -g?)
      – Robert Calhoun
      Mar 3 '17 at 14:52












      For me worked well just without -h (OS X 10.12.3): sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail
      – vearutop
      Mar 6 '17 at 3:42




      For me worked well just without -h (OS X 10.12.3): sudo lsof -n | cut -f1 -d' ' | uniq -c | sort | tail
      – vearutop
      Mar 6 '17 at 3:42












      So be it without -h
      – sanmai
      Mar 6 '17 at 10:27




      So be it without -h
      – sanmai
      Mar 6 '17 at 10:27












      This is the only answer that helped me to root cause my issue.. thanks :)
      – SgtPooki
      Mar 11 '17 at 10:46




      This is the only answer that helped me to root cause my issue.. thanks :)
      – SgtPooki
      Mar 11 '17 at 10:46












      For what it's worth, you can also get a list of the process IDs with the most open files using lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail.
      – Chris Frederick
      May 12 '17 at 4:52




      For what it's worth, you can also get a list of the process IDs with the most open files using lsof -n | sed -E 's/^[^ ]+[ ]+([^ ]+).*$/1/' | uniq -c | sort | tail.
      – Chris Frederick
      May 12 '17 at 4:52










      up vote
      9
      down vote













      Folks, on Mavericks 10.9.4



      ulimit -n 2048 works fine. You may need to launch a new login session.






      share|improve this answer

























        up vote
        9
        down vote













        Folks, on Mavericks 10.9.4



        ulimit -n 2048 works fine. You may need to launch a new login session.






        share|improve this answer























          up vote
          9
          down vote










          up vote
          9
          down vote









          Folks, on Mavericks 10.9.4



          ulimit -n 2048 works fine. You may need to launch a new login session.






          share|improve this answer












          Folks, on Mavericks 10.9.4



          ulimit -n 2048 works fine. You may need to launch a new login session.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 4 '14 at 16:19









          Clustermagnet

          2991611




          2991611






















              up vote
              1
              down vote













              You can run



              lsof -n


              which process open too many files.



              then kill it .



              or



              sysctl -w kern.maxfiles=20480


              change it to bigger one.






              share|improve this answer

















              • 2




                Please explain how this answer differs from the ones already given.
                – Stephen Rauch
                May 18 '17 at 3:30















              up vote
              1
              down vote













              You can run



              lsof -n


              which process open too many files.



              then kill it .



              or



              sysctl -w kern.maxfiles=20480


              change it to bigger one.






              share|improve this answer

















              • 2




                Please explain how this answer differs from the ones already given.
                – Stephen Rauch
                May 18 '17 at 3:30













              up vote
              1
              down vote










              up vote
              1
              down vote









              You can run



              lsof -n


              which process open too many files.



              then kill it .



              or



              sysctl -w kern.maxfiles=20480


              change it to bigger one.






              share|improve this answer












              You can run



              lsof -n


              which process open too many files.



              then kill it .



              or



              sysctl -w kern.maxfiles=20480


              change it to bigger one.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered May 18 '17 at 2:52









              SaintKnight

              112




              112








              • 2




                Please explain how this answer differs from the ones already given.
                – Stephen Rauch
                May 18 '17 at 3:30














              • 2




                Please explain how this answer differs from the ones already given.
                – Stephen Rauch
                May 18 '17 at 3:30








              2




              2




              Please explain how this answer differs from the ones already given.
              – Stephen Rauch
              May 18 '17 at 3:30




              Please explain how this answer differs from the ones already given.
              – Stephen Rauch
              May 18 '17 at 3:30










              up vote
              0
              down vote













              I encountered it while doing a chmod -R so I got it around by taking smaller steps, e.g.



              # for each directory
              find . -type d -exec chmod 755 {} ;





              share|improve this answer

















              • 1




                While this may be a work-around, it doesn't appear to actually answer the question. Perhaps explaining that you cannot get rid of the message and then proposing this as one way to make it less of an issue would improve your answer.
                – music2myear
                Jan 4 '17 at 21:11















              up vote
              0
              down vote













              I encountered it while doing a chmod -R so I got it around by taking smaller steps, e.g.



              # for each directory
              find . -type d -exec chmod 755 {} ;





              share|improve this answer

















              • 1




                While this may be a work-around, it doesn't appear to actually answer the question. Perhaps explaining that you cannot get rid of the message and then proposing this as one way to make it less of an issue would improve your answer.
                – music2myear
                Jan 4 '17 at 21:11













              up vote
              0
              down vote










              up vote
              0
              down vote









              I encountered it while doing a chmod -R so I got it around by taking smaller steps, e.g.



              # for each directory
              find . -type d -exec chmod 755 {} ;





              share|improve this answer












              I encountered it while doing a chmod -R so I got it around by taking smaller steps, e.g.



              # for each directory
              find . -type d -exec chmod 755 {} ;






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Dec 14 '16 at 18:50









              Michael

              1




              1








              • 1




                While this may be a work-around, it doesn't appear to actually answer the question. Perhaps explaining that you cannot get rid of the message and then proposing this as one way to make it less of an issue would improve your answer.
                – music2myear
                Jan 4 '17 at 21:11














              • 1




                While this may be a work-around, it doesn't appear to actually answer the question. Perhaps explaining that you cannot get rid of the message and then proposing this as one way to make it less of an issue would improve your answer.
                – music2myear
                Jan 4 '17 at 21:11








              1




              1




              While this may be a work-around, it doesn't appear to actually answer the question. Perhaps explaining that you cannot get rid of the message and then proposing this as one way to make it less of an issue would improve your answer.
              – music2myear
              Jan 4 '17 at 21:11




              While this may be a work-around, it doesn't appear to actually answer the question. Perhaps explaining that you cannot get rid of the message and then proposing this as one way to make it less of an issue would improve your answer.
              – music2myear
              Jan 4 '17 at 21:11










              up vote
              0
              down vote













              For latest macOS (at the time of writing: 10.14.1), you can use sudo launchctl limit maxfiles 64000 524288 (by default it was 256), but it works only within current session. Use launchctl job from @ninjaPixel (https://superuser.com/a/1171028/760235) for permanent solution.






              share|improve this answer



























                up vote
                0
                down vote













                For latest macOS (at the time of writing: 10.14.1), you can use sudo launchctl limit maxfiles 64000 524288 (by default it was 256), but it works only within current session. Use launchctl job from @ninjaPixel (https://superuser.com/a/1171028/760235) for permanent solution.






                share|improve this answer

























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  For latest macOS (at the time of writing: 10.14.1), you can use sudo launchctl limit maxfiles 64000 524288 (by default it was 256), but it works only within current session. Use launchctl job from @ninjaPixel (https://superuser.com/a/1171028/760235) for permanent solution.






                  share|improve this answer














                  For latest macOS (at the time of writing: 10.14.1), you can use sudo launchctl limit maxfiles 64000 524288 (by default it was 256), but it works only within current session. Use launchctl job from @ninjaPixel (https://superuser.com/a/1171028/760235) for permanent solution.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 23 at 17:33









                  Worthwelle

                  2,2593724




                  2,2593724










                  answered Nov 23 at 16:59









                  Dzmitry Hubin

                  1




                  1






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f433746%2fis-there-a-fix-for-the-too-many-open-files-in-system-error-on-os-x-10-7-1%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Index of /

                      Tribalistas

                      Listed building