On macosx 10.7, using bash
The first call to ulimit -n succeeds, while the second fails.
a:$ ulimit -n
2560
a:$ ulimit -n 5000
a:$ ulimit -n
5000
a:$ ulimit -n 6000
bash: ulimit: open files: cannot modify limit: Operation not permitted
however if I try in a new shell (or another shell) to ulimit -n 6000, it succeeds:
a:$ ulimit -n
2560
a:$ ulimit -n 6000
a:$ ulimit -n
6000
Why is that?