Skip to main content
1 of 2
pedz
  • 483
  • 2
  • 5
  • 20

@bmike gave me most of what I needed. A few additional clues and limitations.

Emacs is an app that lives in /Applications/Emacs.app and it has lots of stuff within that directory. I finally took it one step at a time. I created a dumpme app:

#include <unistd.h>
#include <signal.h>

int main(int argc, char *argv[])
{
  pid_t pid = getpid();

  kill(pid, SIGBUS);
}

and I did the codesign as suggested and I got a core file. Note that before the code side, I would get

zsh: bus error  ./dumpme

and after the codesign I would get:

zsh: bus error (core dumped)  ./dumpme

A preliminary step in building the Emacs app is temacs which is an executable without an initial state. I codesigned it and it produced a core too when started from the Terminal prompt. Then I did the codesign for /Applications/Emacs.app/Contents/MacOS/Emacs and I got this nastygram:

codesign -s - -f --entitlements tmp.entitlements /Applications/Emacs.app/Contents/MacOS/Emacs
/Applications/Emacs.app/Contents/MacOS/Emacs: replacing existing signature
/Applications/Emacs.app/Contents/MacOS/Emacs: code object is not signed at all
In subcomponent: /Applications/Emacs.app/Contents/MacOS/Emacs.pdmp

A search found this answer so I backed up and I did sudo codesign -s - -f --deep --entitlements tmp.entitlements /Applications/Emacs.app -- (Note the addition of --deep). Also, without the sudo I got permission problems.

If I start Emacs from the Finder or via open /Applications/Emacs.app and kill it, I do not get a core file. But if I start it from my Terminal prompt I do. e.g.

% /Applications/Emacs.app/Contents/MacOS/Emacs

I suspect there is a fix when starting from Finder as well. I'm assuming it has something to do with the ulimit -c unlimited that is suggested / required.

pedz
  • 483
  • 2
  • 5
  • 20