Extend the stack size on macOS Sierra - macos

When I try to extend the stack size on macOS Sierra using the command ulimit -s unlimited the terminal print the next message:
-bash: ulimit: stack size: cannot modify limit: Operation not permitted.
I also tried to use sudo ulimit -s unlimited but it doesn't leave me either. Anyone know something?

There is a hard limit for the stack size on OS X that can be seen running:
ulimit -Hs
This is the maximum you can set the stack size as. So instead of unlimited the best you can do is
ulimit -s 65532
See this question for more details.

Related

[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] - Not working even after changing sysctl.conf file

I changed /etc/sysctl.conf file and added statement vm.max_map_count=262144, restarted laptop and still the same error keeps occurring whenever I execute: docker-compose -f docker-amundsen.yml up on terminal.
Can anyone please suggest some solution?
EDIT: Solved now.
To make it persistent, you can add this line:
$ sudo nano /etc/sysctl.conf
vm.max_map_count=262144
$ sudo sysctl -p

Error while running make check for mesos-1.9.0 on Mac os

While running make check for mesos-1.9.0 on mac os, I get an error for 'ulimit -u`. This is the error message on Terminal
Detected low process count ulimit (2837 vs 4096). Increase 'ulimit -u' to avoid spurious test failures.
I tried setting the hard and soft limits for ulimit (ulimit -u 4096and ulimit -n 4096) on the Terminal as well as updating my .bash_profile and running source ~/.bash_profile but make check still fails.
Can someone help me fix this ?
TIA.
sudo ulimit -n 65536 200000
Reference: https://wilsonmar.github.io/maximum-limits

How to set stacksize to unlimited OS X 10.8?

I don't know if I'm doing something wrong but when I type
$limit stacksize unlimited
Into a terminal on Mountain Lion I get:
-bash: limit: command not found
and so I try:
sudo ulimit -s unlimited
Which won't work either. Can you please tell me what I should be using to get an unlimited stacksize in terminal?
I have now realised that for the limit command I need to use a tcsh shell.

increase ulimit for # of file descriptors

As normaluser:
$ ulimit -n 4096
-bash: ulimit: open files: cannot modify limit: Operation not permitted
As root it works as desired - but then it won't affect normaluser.
How to get out of this catch 22? I'll need this to be persistent.
You may want to look at /etc/security/limits.conf
To change file descriptor limit as normal user before running any applicaiton.
I use this small utility fdlimit which will increase file descriptor limit using "setrlimit()" system call before executing any program.
I use it like this
$ sudo ./fdlimit <fdlimit> <program_to_run>

How to enable full coredumps on OS X?

It looks that OS X (10.6) does not generates codedumps by default.
Using the ulimit -c unlimited is not a good solution because ulimit does set the limit in an environment variable. This will work only for console applications executed from the shell that executed ulimit. If you have a gui application this will not work.
You can enable core dumps and then launch your GUI app from the command line using open.
$ ulimit -c unlimited
$ open /Applications/Address\ Book.app
I just looked at TN2124 and it suggests a similar approach, only without using open and just launching the app directly, e.g.
$ ulimit -c unlimited
$ /Applications/TextEdit.app/Contents/MacOS/TextEdit

Resources