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

So in my search to fine tune Mathematica to what works for me, I found a nice setting that helps separate variable declaration between notebooks. Under Global Preferences, searching for CellContext and changing from "Global'*" to Notebook does this. Sweet, but now I am having trouble clearing all the variables. ClearAll["Global`*"] no longer works, and so I figured, since that's the setting I changed, maybe it would now be ClearAll[Notebook]. However, this doesn't work either and warns that Notebook is protected.

Maybe there is a better method of operation instead of the path I'm attempting to go down. I use Mathematica to do all of my Physics homework in; between each problem I usually do a ClearAll so I'm not contaminating possible variables between problems with wrong values.

share|improve this question
Perhaps this may help too – Rojo Apr 24 '13 at 10:35
up vote 9 down vote accepted

You can do

ClearAll[Evaluate[$Context <> "*"]]

Or switch the context to be unique to each group of cells.¸

Example menu setting

Depending on your needs you can also use Quit[], which will terminate the kernel, therbye clearing everything.

share|improve this answer

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.