Mathematica codes put in the kernel initialization script $UserBaseDirectory/Kernel/init.m will be automatically loaded every time when the Mathematica Kernel is started.
The value of the Mathematica environment variable
$UserBaseDirectory
is system-dependent. One can find
out its value by evaluating $UserBaseDirectory
in a
Mathematica notebook:
- Linux:
$HOME/.Mathematica/Kernel/init.m
- macOS:
$HOME/Library/Mathematica/Kernel/init.m
- Windows 7:
C:\\Users\\<user>\\AppData\\Roaming\\Mathematica\\init.m