How to add persist shell ulimit settings on Mac?

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">
<dict>
    <key>GroupName</key>
    <string>wheel</string>
    <key>InitGroups</key>
    <true/>
    <key>Label</key>
    <string>core dumps launchctl</string>
    <key>ProgramArguments</key>
    <array>
        <string>launchctl</string>
        <string>limit</string>
        <string>core</string>
        <string>unlimited</string>
        <string>unlimited</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>UserName</key>
    <string>root</string>
</dict>
</plist>

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