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


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


it appends the path


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.

Whenever I do

{"/Applications/Mathematica11.app/Contents/AddOns/Applications", \
"/Applications/Mathematica11.app/Contents/SystemFiles/Links", \
"/Users/gkdgoutam/Library/Mathematica/Kernel", \
"/Users/gkdgoutam/Library/Mathematica/Autoload", \
"/Users/gkdgoutam/Library/Mathematica/Applications", \
"/Library/Mathematica/Kernel", "/Library/Mathematica/Autoload", \
"/Library/Mathematica/Applications", ".", "/Users/gkdgoutam", \
"/Applications/Mathematica11.app/Contents/AddOns/Packages", \
"/Applications/Mathematica11.app/Contents/SystemFiles/Autoload", \
"/Applications/Mathematica11.app/Contents/AddOns/Autoload", \ .   
"/Applications/Mathematica11.app/Contents/AddOns/Applications", \
"/Applications/Mathematica11.app/Contents/AddOns/ExtraPackages", \
Packages", \
ICC",     "/Users/gkdgoutam/Softwares/HEP_Softwares/HPL", \
"/Users/gkdgoutam/Softwares/HEP_Softwares/HypExp", \
"/Users/gkdgoutam/Softwares/HEP_Softwares/MT-1.0", \
"/Users/gkdgoutam/Softwares/HEP_Softwares/MT-1.0", \
"/Users/gkdgoutam/Softwares/HEP_Softwares/MT-1.0", \
"/Users/gkdgoutam/Softwares/HEP_Softwares/MT-1.0", \
"/Users/gkdgoutam/Softwares/HEP_Softwares/MT-1.0", \
"/Users/gkdgoutam/Softwares/HEP_Softwares/MT-1.0", \

Update: Basically I want a clear view/answer on how to edit the output of \$Path so that I can in principle put any PATH which Mathematica will search by default every time I open Mathematica and which will show up in output of \$Path. Since I have somehow messed with I wanted to look at the file itself where I can add/remove the PATHs. For example in this case I want to remove multiple entry of


from \$Path.

  • $\begingroup$ Basically following this I messed up mathematica.stackexchange.com/questions/165418/… $\endgroup$ – Boogeyman May 14 '18 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 '18 at 14:10
  • $\begingroup$ Yes, unfortunately I did. FindFile["MT`"] gives /Users/gkdgoutam/Library/Mathematica/Kernel/MT.m $\endgroup$ – Boogeyman May 14 '18 at 14:12
  • $\begingroup$ Thanks. I deleted from there. But still in \$Path there are 3 such paths exist. How do I remove two of them? $\endgroup$ – Boogeyman May 14 '18 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$ – Boogeyman May 14 '18 at 14:21

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/gkdgoutam/Softwares/HEP_Softwares/MT ) inside


For example:

$MTPath = "/Users/gkdgoutam/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


by adding the following:

| improve this answer | |

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