$BaseDirectory

$BaseDirectory
gives the base directory in which systemwide files to be loaded by Mathematica are conventionally placed.

DetailsDetails

  • $BaseDirectory returns the full name of the directory as a string.
  • Typical values are:
  • C:\ProgramData\MathematicaWindows
    /Library/MathematicaMacintosh
    /usr/share/MathematicaUnix
  • The value of $BaseDirectory can be specified by setting the operating system environment variable when the Mathematica kernel is launched. It cannot be reset from inside the kernel.
  • Typical subdirectories of $BaseDirectory are:
  • ApplicationsMathematica application packages
    Autoloadpackages to be autoloaded on startup
    FrontEndfront end initialization files
    Kernelkernel initialization files
    Licensinglicense management files
    SystemFilesgeneral system files
  • These subdirectories are, if possible, created automatically the first time Mathematica is run.
  • Appropriate subdirectories are automatically included on $Path.
  • The subdirectories of $BaseDirectory are given in $Path after the corresponding subdirectories of $UserBaseDirectory.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

The base directory in which systemwide files are placed:

In[1]:=
Click for copyable input
Out[1]=

Subdirectories and files of $BaseDirectory:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
New in 5
New to Mathematica? Find your learning path »
Have a question? Ask support »