Skip to content

Instantly share code, notes, and snippets.

@gembin
Created January 25, 2018 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gembin/a5d07811df03bcde54226be5a54137b6 to your computer and use it in GitHub Desktop.
Save gembin/a5d07811df03bcde54226be5a54137b6 to your computer and use it in GitHub Desktop.
Mac OS Open Files Limit

Open Files Limit

Changing Limit For Current Session

Most operating systems can change the open-files limit for the current shell session using the ulimit -n command:

ulimit -n 200000

Mac OS X El Capitan

Start by checking the current open file limit values with:

launchctl limit maxfiles

The response should look something like this:

maxfiles    65536          65536

The first column is the soft limit and the last column is the hard limit.

To change the open files limits on Mac OS X El Capitan, perform the following steps:

  1. Add the following line to your .bash_profile or analogous file:
ulimit -n 65536 200000
  1. Save and close the file. Next open /etc/sysctl.conf (or create it if it doesn’t already exist) and add the following settings:
kern.maxfiles=200000
kern.maxfilesperproc=200000
  1. Restart your computer and enter ulimit -n into your terminal. If your system is configured correctly, you should see that maxfiles has been set to 200000.

Mac OS X Yosemite

Start by checking the current open file limit values with:

launchctl limit maxfiles

The response should look something like this:

maxfiles    65536          65536

The first column is the soft limit and the last column is the hard limit.

To change the open files limits on Mac OS X Yosemite, perform these steps:

  1. Add the following line to your .bash_profile or analogous file:
ulimit -n 65536 200000
  1. Save and close the file. Next edit the /etc/launchd.conf file and add:
limit maxfiles 200000
  1. Save and close the file.

  2. After restarting, verify the new limits by running:

launchctl limit maxfiles

The response output should look something like this:

maxfiles    65536          200000

Mac OS X Older Versions

Start by checking the current open file limit values with:

launchctl limit maxfiles

The response should look something like this:

maxfiles    10240          10240

The first column is the soft limit and the last column is the hard limit.

To adjust the maximum open file limits in OS X 10.7 (Lion) up to but not including OS X Yosemite, perform the following steps:

  1. Edit (or create) /etc/launchd.conf and increase the limits by adding:
limit maxfiles 65536 200000
  1. Save the file and restart the system for the new limits to take effect.

  2. After restarting, verify the new limits by running:

launchctl limit maxfiles

The response output should look something like this:

maxfiles    65536          200000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment