When I start up a fresh executing Mathematica on my MacOS system and I open a Notebook file there is always one symbol defined in the Global context. This symbol is \$MySource and it points (via a directory symbolic link) to my default location for various notebook and package files.

I don't remember setting this up but I must have since it points to an iCloud folder that I myself created. I have searched all preferences and other locations such as account defined environment variables and I can't find this definition anywhere. I have searched the documentation for \$MySource and MySource but it leads to various content entries and none of those seem to contain the strings \$MySource or MySource.

If I change it to something different then when I shutdown Mathematica and start it up again it returns to the original definition to thru the directory link.

How do you set this value and does it have any special purpose other than providing a default file lookup location?

  • 1
    $\begingroup$ What version of Mathematica are you using? Did you check if this was defined in init.m? $\endgroup$ – J. M.'s ennui May 17 '20 at 21:03
  • $\begingroup$ @J.M. Mathematica version 12.1 and init.m does not contain any references to $MySource or MySource. Yes, I looked there. $\endgroup$ – K7PEH May 17 '20 at 21:30
  • 5
    $\begingroup$ @J.M. OK, I looked again. After I posted the previous comment I decided that maybe there was more than one init.m file on my system. I searched via shell find command and found more than a dozen init.m files. Apparently, I looked in the wrong spot, the first hit from Mac OS Finder. I found the definition of $MySource in the main default init.m. However, I do not remember ever doing that definition. Then again, I am 72+ in age so maybe I need to start writing stuff down. $\endgroup$ – K7PEH May 17 '20 at 21:41
  • $\begingroup$ @K7PEH where is the init.m file located where you have defined $MySource? $\endgroup$ – CA Trevillian May 18 '20 at 3:07
  • 1
    $\begingroup$ Do you know "Pettson and Findus"? A repeating form of dialog goes like this (translated from the German version): Pettson: "Findus, why did you write that into my init.m?" Findus: "But Pettson, I didn't." Pettson: "Well, then I must have done it myself..." Just as a side note: Findus is a cat. ;) $\endgroup$ – Henrik Schumacher May 18 '20 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.