The
/cores directory is only writable by root:
Code Block % ls -ld /cores |
drwxr-xr-x 3 root wheel 96 26 Feb 10:34 /cores |
So you only get a core dump when the process is running as root:
Code Block % ulimit -c unlimited |
% ./crash |
zsh: abort ./crash |
% ls -lha /cores |
total 0 |
drwxr-xr-x 2 root wheel 64B 13 Dec 2019 . |
drwxr-xr-x 20 root wheel 640B 1 Jan 2020 .. |
% # No core! |
% |
% sudo ./crash |
% ls -lha /cores |
total 4900984 |
drwxr-xr-x 3 root wheel 96B 26 Feb 10:34 . |
drwxr-xr-x 20 root wheel 640B 1 Jan 2020 .. |
-r-------- 1 root wheel 2.3G 26 Feb 10:35 core.21226 |
% # Now we get a core. |
You can change the owner and permissions of
/cores if you want:
Code Block % sudo chown :staff /cores |
% sudo chmod g+w /cores |
% ls -ld /cores |
drwxrwxr-x 2 root staff 64 Jan 1 2020 /cores |
Personally I only do this in a VM. I prefer not to make system-wide configuration changes on my main Mac.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"