80

On Mac OS X, if I send SIGQUIT to my C program, it terminates, but there is no core dump file.

Do you have to manually enable core dumps on Mac OS X (how?), or are they written to somewhere else instead of the working directory?

kenorb
  • 137,499
  • 74
  • 643
  • 694
xyz
  • 26,256
  • 29
  • 100
  • 125
  • 2
    Instead of complaining you could rephrase it - in fact your title does not even have a verb in it. I would gladly upvote your question because I'm interested about the subject. Still I think that the question is not following the quality required by SO. I even have related question regarding coredump http://stackoverflow.com/questions/2207233/how-to-enable-full-coredumps-on-os-x By the way, coredumps are to be located in `/cores` but do look in this folder using the terminal and root account. – sorin Feb 05 '10 at 14:12
  • 5
    @Sorin A suggestion is not a problem, pettiness is. – xyz Feb 05 '10 at 14:22
  • 1
    @Sorin FYI 'are' is a (linking) verb. Not that it really matters here, but if we are criticizing grammar let's get it right ;) http://examples.yourdictionary.com/reference/examples/examples-of-linking-verbs.html – Rick Smith Apr 11 '14 at 20:01
  • 1
    Related: [How to generate core dumps in Mac OS X?](http://stackoverflow.com/questions/9412156/how-to-generate-core-dumps-in-mac-os-x). – kenorb Oct 11 '14 at 14:33

5 Answers5

97

It seems they are suppressed by default. Running

$ ulimit -c unlimited

Will enable core dumps for the current terminal, and it will be placed in /cores as core.PID. When you open a new session, it will be set to the default value again.

Timo Tijhof
  • 9,867
  • 6
  • 33
  • 47
xyz
  • 26,256
  • 29
  • 100
  • 125
39

On macOS, your crash dumps are automatically handled by Crash Reporter.

You can find backtrace files by executing Console and going to User Diagnostic Reports section (under 'Diagnostic and Usage Information' group) or you can locate them in ~/Library/Logs/DiagnosticReports.

You can also check where dumps are generated by monitoring system.log file, e.g.

tail -f /var/log/system.log | grep crash

The actual core dump files you can find in /cores.

See also:

kenorb
  • 137,499
  • 74
  • 643
  • 694
14

Additionally, the /cores directory must exist and the user running the program must have write permissions on it.

user666406
  • 171
  • 1
  • 4
13

The answer above,

ulimit -c unlimited

works -- but be sure to run that in the same terminal from which you will run the program that dumps core. You need to run the ulimit command first.

Joshua Richardson
  • 1,655
  • 20
  • 22
12

by default, specific directories in mac osx are hidden. you might want to enable this feature in the terminal and then the core dump should be visible within the directory /cores.

defaults write com.apple.finder AppleShowAllFiles TRUE

Gnark
  • 3,870
  • 7
  • 31
  • 44
  • 4
    Thank you. I was browsing with Terminal (ls -lah), but that's a useful tip anyway. – xyz Jan 17 '10 at 12:44