`ulimit -n` for non-root I'm running El Capitan / Mac OSX 10.11.6 (15G1108) and I want to increase the "Max Open files" for some of my terminals / bash sessions. I'm logged in with my normal users. I read through all the guides I could find and managed to increase some limits:

As my user:

$ launchctl limit maxfiles
    maxfiles    200000         200000        


But, when I try to set the limit, I fail:

$ ulimit -n 8096
-bash: ulimit: open files: cannot modify limit: Operation not permitted


The strange thing is that I actually can set the ulimit if I switch to root:

$ sudo bash
$ ulimit -n 9086


Now of course, running everything as root is stupid, so I'm searching for a better solution. How can I allow my user to also increase his "Max Files Limit"?

What I have done already:

$ cat /etc/sysctl.conf
kern.maxfiles=65536
kern.maxfilesperproc=65536

$ cat /Library/LaunchDaemons/limit.maxfiles.plist
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
  &lt;plist version="1.0"&gt;
    &lt;dict&gt;
      &lt;key&gt;Label&lt;/key&gt;
        &lt;string&gt;limit.maxfiles&lt;/string&gt;
      &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
          &lt;string&gt;launchctl&lt;/string&gt;
          &lt;string&gt;limit&lt;/string&gt;
          &lt;string&gt;maxfiles&lt;/string&gt;
          &lt;string&gt;200000&lt;/string&gt;
          &lt;string&gt;200000&lt;/string&gt;
        &lt;/array&gt;
      &lt;key&gt;RunAtLoad&lt;/key&gt;
        &lt;true/&gt;
      &lt;key&gt;ServiceIPC&lt;/key&gt;
        &lt;false/&gt;
    &lt;/dict&gt;
  &lt;/plist&gt;
Having had this exact same problem, I ultimately found that my bash startup sequence (.bashrc or similar) was doing a ulimit -n 1024; and that caused both the soft and the hard limit to get set; the latter of which prevented any attempt at raising it afterwards, giving rise to the "bash: ulimit: open files: cannot modify limit: Operation not permitted" error.

So, removing that command got the soft and hard limits restored to the apparent system defaults of 256 and unlimited respectively. The latter is what will enable you to ulimit -n &lt;whatever&gt; again.

In your case, assuming the cause is similar and your Library/LaunchDaemons/limit.maxfiles.plist is still in place as listed, I expect that ulimit -Sn and ulimit -Hn will report both to be 200000.