Change Mac OS X user Limits

如何修改max os x关于用户的配额限制,主要是进程数和文件句柄数。
I always had a process limitation problem on OSX. You may encounter this when you open too much applications. In my case, using iTerm, I easyily open far too much shells to servers I have to deal with.
You will then get a « login: fork: Resource temporarily unavailable » error message. When trying to start a new application, you will barely see the icon in the dock, then it will disapear. Now you’re in Troubble !
Hopefully, as OS X is a UNIX system, you have a solution. The only bad side is that you will have to reboot.
If you are running Leopard (10.5.x), using the first trick will lead you to the Windows Server not running… Pretty anoying. Use SSH and put back the Windowserver in its place. This is what I did, with the help of the blog at http://ruminate.net/pdm :
Sudo -s to get a root shell. Then create the two files like :
引用
/etc/launchd.conf

cat /etc/launchd.conf

limit maxproc 512 2048
limit maxfiles 512 unlimited

引用
/etc/sysctl.conf

cat /etc/sysctl.conf

# Turn up maxproc
kern.maxproc=2048

# Turn up the maxproc per user
kern.maxprocperuid=1024

# Remove core files
kern.coredump=0

After a reboot, your max user process will be raised to 512 :
ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) 6144
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 512
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 512
virtual memory          (kbytes, -v) unlimited

你可能感兴趣的:(Mac OS X)