Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I've quite forgotten: what file does one modify in order to add directories to $Path globally? Specifically, I want to include $UserBaseDirectory/ExtraPackges.

Or does one do it by means of modifying some setting in the OptionInspector (for Global Preferences) and, if so, which setting? I didn't see a relevant one under Global Options>File Locations.

share|improve this question
add comment

1 Answer

up vote 15 down vote accepted

Have you tried adding

AppendTo[$Path, FileNameJoin[{$UserBaseDirectory, "ExtraPackges"}]]

to the file

FileNameJoin[{$UserBaseDirectory, "Kernel", "init.m"}]

?

init.m is described here, under "more information".

share|improve this answer
    
I suspected the method was to include such an AppendTo, but the issue was which init.m to use. Just to be sure: one uses init.m for Kernel, not for FrontEnd? And there's no way to do this via OptionInspector? –  murray Feb 16 '12 at 17:16
2  
I don't know if there is a way to do it from the Options Inspector. I tried the init.m in the indicated (Kernel) folder and it worked; my mental model of what is going on is: kernel gets started, loads init.m and runs it, then starts normal execution. So I just appended the path in there. Basically I think of it as autoexec.bat projected roughly 25 years into the future. –  acl Feb 16 '12 at 17:23
    
@murray $Path is a kernel variable, so this needs to be done for Kernel/init.m, exactly as acl said. I don't think the front end could execute AppendTo at all.. –  Szabolcs Feb 16 '12 at 17:40
    
OK, @Szabolics. So the obvious next question is: how could one learn that $Path is a kernel variable, unknown to the front end directly? –  murray Feb 16 '12 at 23:54
add comment

Your Answer

 
discard

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.