3

I recently found out that Mac leaves all the core file in /cores directory.
It's hard to tell what application caused the core dump if even possible.

Wonder if I can configure system to leave the cores where the executable resides as in Linux.

Thank you

eugene
  • 39,839
  • 68
  • 255
  • 489

2 Answers2

1

You can use the sysctl command to edit corefile path

sudo sysctl -w kern.corefile=/this/is/new/path

By default kern.corefile=/cores/core.%P, %P refer to process id. It can be replace by %N => process name, %U => user name. You can check the source code here

if you want to disable core dump, using the following command

sudo sysctl -w kern.coredump=0

or edit /etc/sysctl.conf, add this line

kern.coredump=0
Steven
  • 47
  • 3
1

Hmm - maybe you can edit /etc/sysctl.conf and help yourself you specifying the core_pattern?

kernel.core_pattern=/cores/core.%e.%p.%h.%t

Maybe that would help you find out more about which process was responsible for the dump

stackmate
  • 908
  • 9
  • 17
  • Where is that documented? No such thing is in my `sysctl.conf`, but the `sysctl(8)` utility shows this configuration variable: `kern.corefile = /cores/core.%P` – Potatoswatter Apr 30 '11 at 00:25
  • actually - yes in os x it is corefile. You can try something like: sudo sysctl -w kern.corefile="%N-%P-%U.core" – stackmate May 02 '11 at 17:38