I can't get any function defined in $UserBaseDirectory/Kernel/init.m to work. For example:

SinDeg[d_] := Sin[d * Degree]; (* Only line in init.m *)


(* => SinDeg[90] *)

However when copying the code and executing it inside a Mathematica notebook, it works fine:

SinDeg[d_] := Sin[d * Degree];
(* => 1 *)

The Mathematica front-end can definitely see the function definitions as it displays SinDeg as an autocompletion suggestion, when typing SinD.

I'm using Mathematica 9 Home Edition on OS X.

  • $\begingroup$ To eliminate the obvious: you have restarted Mathematica after adding this line to init.m? $\endgroup$ Commented Mar 11, 2013 at 23:50
  • $\begingroup$ @SjoerdC.deVries yes. $\endgroup$
    – Tyilo
    Commented Mar 11, 2013 at 23:51
  • $\begingroup$ What do you get when you type ?SinDeg directly after Mathematica starts up? $\endgroup$ Commented Mar 12, 2013 at 0:42
  • $\begingroup$ @SjoerdC.deVries I get this error: Information::notfound: Symbol SinDeg not found. >> $\endgroup$
    – Tyilo
    Commented Mar 12, 2013 at 0:44
  • $\begingroup$ Could you check whether you really have an underscore in your definition in the init.m file? $\endgroup$ Commented Mar 12, 2013 at 0:44

1 Answer 1


This has to do with the Notebook's default context setting in the evaluation menu. If it isn't set to Global`, the definitions made in init.m are not seen.

As rm-rf says, a good way to put custom definitions in the init.m would be to use Begin and End to create an Init` context and append that context to the context path so that the definitions are available regardless of the notebook's context. (better still, use packages)


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.