fork: Resource temporarily unavailable

OSX 2010. 2. 15. 15:41

Mac OS X … “fork: Resource temporarily unavailable”

Almost a year ago, I made the switch to using Mac OS X as my primary workstation. As difficult as the transition was during my first 3 weeks, it has now become second nature to me. I haven’t had any major issues along the way, but now and then, I have had to tweak a thing or two. Here is the most recent such example.

Lately, I’ve been seeing a fair number of the following error, when launching commands under Bash within a local Terminal session. It’s rather annoying, because it stops me from getting any work done. As a systems administrator, I have lots of Terminal sessions open, and this is where the error has always manifested itself.

[laptop:~ root]$ ssh somehost 
-bash: fork: Resource temporarily unavailable

The first time this happened to me, I didn’t think much of it, so I rebooted my system. Today, I did not feel like rebooting my system, because I have a ton of work in progress. I suspect most people won’t hit this resource limit, but if you’re a power user, you eventually might.

Like other Unix-like operating systems, Max OS X limits the maximum number of processes, system-wide and per-user, but it does so with a rather conservative number. On my Mac, system-wide processes were limited to 512, and per-user processes were limited to 266. I’ve never encountered this problem on Linux, because these values are dynamically set in the kernel, based on the amount of memory installed in the Linux system.

Here’s how I resolved this problem.

  • First, determine what your system’s current limits are. These are the values on my installation of Mac OS X 10.5 with 4 GB of RAM.
[laptop:~ root]$ sysctl -a | grep maxproc | grep =
kern.maxproc = 512
kern.maxprocperuid = 266
  • Now set these to higher values. I suggest approximately doubling what you already have.
[laptop:~ root]$ sysctl -w kern.maxproc=1024
[laptop:~ root]$ sysctl -w kern.maxprocperuid=512
  • You’ll also want to apply these changes automatically at system bootup. To do so, add them to the /etc/sysctl.conf file.
[laptop:~ root]$ cat /etc/sysctl.conf
kern.maxproc=1024
kern.maxprocperuid=512
  • At this point, launched processes will still inherit the default maxprocperuid value of 266. I would like to change this inherited default value for new processes automatically, but I haven’t found a way to increase the default system-wide soft-limit of maxprocperuid on Mac. On Linux, I simply update the /etc/security/limits.conf file, but I don’t see such a file under Mac OS X. If you know of a way to do this in Mac OS X, leave a comment below. For now, I’ve added the following command to my user’s .bash_profile file. The value of 512 is intended to match that of kern.maxprocperuid shown above.
ulimit -u 512
  • To confirm the change, launch a new Terminal session, and run the following command. Before the change, you will have seen “266.” After the change, you should see “512″.
[laptop:~ root]$ 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) 256
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

:

타임머신 사용

OSX 2010. 2. 15. 15:08

외장하드 있으시면 일부 파티션을 나눠 타임머신으로 그 파티션을 타겟 설정해서 os 클린설치와 어플설치를 마치고 외장하드를 연결해서 한번 백업받아놓으면 나중에 OS DVD 넣어서 부팅후 타임머신 백업으로부터 복구하시면 될듯.

:

Mail Backup

OSX 2010. 2. 11. 22:41

술 픈앙마     

여러가지 방법이 있으나...
1. 사파리 북마크 : 파일 메뉴의 책갈피 보내기로하여 HTML로 저장한 후 나중에 가져오기 하시면 됩니다.
2. 메일
기본적으로 ~/라이브러리/Mail/Mailboxes에 메일이 보관됩니다.
그냥 ~/라이브러리/Mail을 백업을 받으셔도 됩니다만
저라면 메일에서 각 메일상자에서 우축마우스 클릭하여 메일상자 아카이브로 저장을 하겠습니다.
환경설정은 ~/라이브러리/Preferences/com.apple.mail.plist 아마 맞을 겁니다. 환경설정은 백업해보지를 않아서요

Gmail 사용하시군요 ..저도 업무용으로만 사용합니다.
저는 Apple Mail에서삭제시 서버에서 삭제가 되지 않게 사용합니다.
Gmail은 거의 용량이 찰일이 없기 때문에 나중에 지메일에서 읽지않음으로 표시하면 Apple메일에서 다시 불러올수 있으니까요...   


from
http://x86osx.com/bbs/view.php?id=allqna&no=8394&ksn=1&kss=1&ksc=0&kst=1&ksm=1&kw=Mail%20%B9%E9%BE%F7

: