How can I want to switch off all messages in a Mathematica session? Quiet[expr] allows me to evaluate expr without messages. Off[msg] switches off the particular message msg.

Is there a command that, once evaluated, guarantees that all further evaluations will run quietly? (Unless some messages are turned back On)

  • $\begingroup$ It is not clear why Quiet isn;t what you are looking for. Do you mean that you want the first message displayed but then no others? Can you please clarify. $\endgroup$ Commented Nov 19, 2013 at 20:40
  • $\begingroup$ Why do you want to turn off all messages? Perhaps what you want is not to turn them off, just to prevent them from being printed (which is technically not the same thing). Try $Messages = {}. $\endgroup$
    – Szabolcs
    Commented Nov 19, 2013 at 20:46
  • $\begingroup$ @MikeHoneychurch I don't want any messages. I want a command that sets the Kernel in a state such that further evaluations won't output messages. $\endgroup$
    – a06e
    Commented Nov 19, 2013 at 21:53
  • 1
    $\begingroup$ @Szabolcs What's the difference between turning messages off and prevent them from being printed? $\endgroup$
    – a06e
    Commented Nov 19, 2013 at 21:53
  • $\begingroup$ @becko ok. in that case suggestions made in the answer and comments should help you $\endgroup$ Commented Nov 19, 2013 at 22:01

2 Answers 2


First, note that turning off messages is technically not the same thing as not printing them. You can avoid printing messages by removing the output channel they're being sent to:

$Messages = {}

Restore the previous behaviour using $Messages = $Output, provided that you haven't changed $Output.

But this won't turn messages off, it will only avoid printing them. Here's the transcript for one particular example which shows the effect of turning off messages, as opposed to not printing them:

In[1]:= boo::mess = "Boo message"
Out[1]= "Boo message"

In[2]:= boo[] := (Message[boo::mess]; 1)

In[3]:= boo[]

During evaluation of In[3]:= boo::mess: Boo message

Out[3]= 1

In[4]:= Check[boo[], "error"]

During evaluation of In[4]:= boo::mess: Boo message

Out[4]= "error"

In[5]:= Off[boo::mess]

In[6]:= Check[boo[], "error"]
Out[6]= 1

In[7]:= On[boo::mess]
        $Messages = {};

In[9]:= Check[boo[], "error"]    
Out[9]= "error"

(Make sure that you evaluate these as separate inputs (cells). Some only have an effect on subsequent inputs, but not on separate code within the same input.)

Notice that turning off the message had an effect on Check, but simply preventing printing it did not. It has effects on various other documented and undocumented parts of Mathematica as well, such as the debugging tools ("Break on messages" feature).

Quiet[expr] does actually prevent the messages generated by expr from reaching any code outside of the Quiet[...], just like turning Off the messages.

Here's a different idea: if your program is written in a script (.m file), then you can run it on a single input line using Get. This means that you can capture all generated messages with $MessageList. Then you can create a message group for them which will allow you to easily toggle them using Off and On. If a new, unexpected message shows up at some point, it will still get printed, which might be good or bad depending on your application.

  • $\begingroup$ +1 Actually, a script is precisely what I have in mind. It would be nice if I could turn all messages off, not just a group. Btw, how do I create a message group (by the [] it seems you wanted to include a link or something)? And couldn't I create a message group including all messages? $\endgroup$
    – a06e
    Commented Nov 20, 2013 at 14:08
  • $\begingroup$ It seems you were trying to include a link. I tried to edit your post to fix it, but it didn't work... I think the $s are messing up the links. $\endgroup$
    – a06e
    Commented Jan 14, 2014 at 21:44
  • $\begingroup$ @becko Thanks for noticing the problem. I'll fix it. I rejected your edit the first time because it showed wrong in the diff view (possibly because of the dollar sign again), then because I was in the process of trying to fix it. There are problems with dollar signs sometimes :-( $\endgroup$
    – Szabolcs
    Commented Jan 14, 2014 at 21:51
  • $\begingroup$ Ok. I did one last edit. I leave in your hands. $\endgroup$
    – a06e
    Commented Jan 14, 2014 at 21:54
  • $\begingroup$ @becko I think I managed to fix it now ... $\endgroup$
    – Szabolcs
    Commented Jan 14, 2014 at 21:59

You can add Quiet to all evaluated expressions by

$Pre = Quiet


No messages

  • 2
    $\begingroup$ it seems not turning off such message as with NumberForm[2.77*^25, ExponentFunction -> (Null &)] $\endgroup$
    – garej
    Commented Feb 6, 2016 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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