Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase rlimit Mac OSX 10.8

I'm learning MongoDB and when I start the mongo shell a wild warning message appeared. It says: enter image description here

How do i change the "soft rlimits". I'm using Mac OSX 10.8.2

Tnx in advance

like image 806
crsuarezf Avatar asked Apr 11 '13 02:04

crsuarezf


People also ask

How do I fix too many open files on my Mac?

A simple fix for the "too many files open" limitation of Mac OS is to use the "ulimit - n" command. Curiously, the value of n appears to be critical to whether or not this command is accepted by MacOS. I've found that ulimit -n 10240 (the default is 256) works but n values higher do not.

How many files are open Mac?

Apple, catering primarily to casual consumer users, has set these limits very conservatively. By default, a user can only have 256 files open and can only have 709 processes running simultaneously.


2 Answers

What you are searching for is launchctl limit maxfiles.
To change it you need to run command launchctl limit maxfiles 1024 2048 for example.
To permanently change those values you need to create /etc/launchctl.conf and set there values you need (see here for details) or add command mentioned above to your ~/.bash_profile.
Or you can create script which will set limit and then launch mongo

like image 127
cody Avatar answered Nov 03 '22 00:11

cody


If you run mongo as a service, you can configure the max open files by adding the next lines to the

/Library/LaunchDaemons/org.mongodb.mongod.plist

  <key>SoftResourceLimits</key>
  <dict>
    <key>NumberOfFiles</key>
    <integer>1024</integer>
  </dict>

and restart the service

like image 38
averasko Avatar answered Nov 03 '22 00:11

averasko