0
$\begingroup$

I was trying to add permanently a path inside $Path.

"/Users/Softwares/HEP_Softwares/MT-1.0"

Following $Path manual I did the following

AppendTo[$Path, FileNameJoin[{$HomeDirectory, "/Softwares/HEP_Softwares/MT-1.0""}]];

which does it successfully. However when I quit kernel it goes away. Then following some other Q/A I have messed with something. Now whenever I do to load the package

<<MT` 

it appends the path

/Users/Softwares/HEP_Softwares/MT-1.0 

in \$Path and does not load the package. Is there any way to overcome the situation without changing my previous definitions of \$Path ? Also what is the best way to add a path in $Path permanently? This question may be duplicate but a clear answer is still lacking.

$\endgroup$
6
  • $\begingroup$ Basically following this I messed up mathematica.stackexchange.com/questions/165418/… $\endgroup$
    – BabaYaga
    May 14, 2018 at 14:03
  • $\begingroup$ Did you modify your kernel init.m as described here? If <<MT` does something expected, check what file it loads using FindFile["MT`"]. $\endgroup$
    – Szabolcs
    May 14, 2018 at 14:10
  • $\begingroup$ Thanks. I deleted from there. But still in \$Path there are 3 such paths exist. How do I remove two of them? $\endgroup$
    – BabaYaga
    May 14, 2018 at 14:13
  • $\begingroup$ Okay. I found the place. ~/Library/Mathematica/Autoload where other paths are also appended, so there I have put the new path. Also from ~/Library/Mathematica/Autoload/init.m I have removed the extra paths. $\endgroup$
    – BabaYaga
    May 14, 2018 at 14:21
  • $\begingroup$ I'm sorry but I'm confused about what exactly is the problem, linked topic is what should be done in this case and adding Autoload init.m is an overreaction. If you could elaborate on how your userbase kernel init.m look,s where MT` is, which path you need and what $Path contains in comparison to what do you expect + why linked topic does not work then it will be specific enough to be reopened I guess. I could've missed the point though so let me know if you disagree. $\endgroup$
    – Kuba
    May 16, 2018 at 11:48

1 Answer 1

0
$\begingroup$

Okay for future reference this could be one answer:

Check the Autoload and Kernel path by $Path.

One can then add the desired PATH (in this case /Users/Softwares/HEP_Softwares/MT ) inside

/Users/Library/Mathematica/Autoload/init.m

For example:

$MTPath = "/Users/Softwares/HEP_Softwares/MT"
If[Not[MemberQ[$Path,$MTPath]],$Path = Flatten[{$Path, $MTPath }]];

Then add the Autoload/init.m in Kernel (if not done already) i.e. in

/Users/Library/Mathematica/Kernel/init.m

by adding the following:

Get[ToFileName["/Users/Library/Mathematica/Autoload","init.m"]]
$\endgroup$

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