Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I have entered some bad code and hit shift+enter before thinking about the perils of finite RAM my computer obviously starts suffering. I have found two options that usually lets me recover without rebooting or in other ways lose the entire notebook.

The first is to switch to a shell and kill -9 the PID of MathKernel process.
The other is to go to the menu Evaluation->Quit Kernel->Local (note that Alt+. and Alt+, are completely ignored by now), by the time I have reached that menu my computer is on its last breath and seconds are of utmost importance. It usually takes seconds just to render the "Do you really want to quit the kernel?" dialog box. I think I would have better success rate if it just quit the kernel as fast as possible. Can I disable this dialog box?

share|improve this question
Related: How to automate a FrontEnd return? – István Zachar Jan 6 '13 at 20:17
up vote 23 down vote accepted

You can add this to your init file, (or just try it out for the current session). It will add a Quit to your key events. This Quit doesn't open a confirm dialog.

  {MenuItem["AddMenu &Quit",
    MenuKey["q", Modifiers -> {"Control"}],
    System`MenuEvaluator -> Automatic]}]]


Alternatively, it can be added to like so:

Menu["Quit Local",
  MenuItem["Quit Kernel",
    MenuKey["q", Modifiers -> {"Control"}],
    MenuEvaluator -> Automatic]
share|improve this answer
Dengen: interesting, does this interrupt a running calculation? It looks to me as if the Quit is queued and won't do what the OP desires... – Albert Retey Jan 6 '13 at 20:58
@ssch - Probably simpler to put it in your MenuSetup file then. I have just added this to my answer. – Chris Degnen Jan 6 '13 at 21:16
Yea that's better – ssch Jan 6 '13 at 21:29
@Dengen: sorry, seems to work as desired. When I tried it yesterday it didn't, but I can't remember what exactly I tried on which version. Today with Version 9 (64bit) on Windows 7 it seems to interrupt a running calculation... – Albert Retey Jan 7 '13 at 16:10
This fixes it. – Rolf Mertig Dec 11 '14 at 21:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.