I want to enable core dump generation by default upon reboot.


ulimit -c unlimited

in a terminal seems to work until the computer is rebooted.


2 Answers 2


Think I figured out something that works.

I used a program called LaunchControl to create a file called enable core dumps.plist at /System/Library/LaunchDaemons with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <string>core dumps launchctl</string>

with these permissions:

$ ls -al enable\ core\ dumps.plist 
-rw-r--r--  1 root  wheel  582 Dec 30 15:38 enable core dumps.plist

and this seemed to do the trick:

$ launchctl limit core
    core        unlimited      unlimited 
$ ulimit -a core
core file size          (blocks, -c) unlimited
<output snipped>

I created a little test program that just crashes:

$ ./a.out 
Segmentation fault: 11 (core dumped)

And, voila, a core dump was generated:

$ # ls -al /cores/
total 895856
drwxrwxr-t@  3 root  admin        102 Dec 30 15:55 .
drwxr-xr-x  31 root  wheel       1122 Oct 18 10:32 ..
-r--------   1 root  admin  458678272 Dec 30 15:55 core.426

To apply persistent shell limits, you need to add ulimit commands into respective startup shell files.

For individual users, use: ~/.bashrc or ~/.bash_profile files.

For all users, use: /etc/bashrc file.

Suggested lines to add:

# Changes the ulimit limits.
ulimit -Sn 4096      # Increase open files.
ulimit -Sl unlimited # Increase max locked memory.

To change system resource limits via launchctl, see: How to persist ulimit settings in macOS?

Not the answer you're looking for? Browse other questions tagged .