Which Mathematica files may be deleted to save space

  1. You can save a lot of space in the Documentation directory by using Delete All Output on all the larger ones and by using disk compression. For example, the v7 documentation Notebook for ContourPlot is 27.7MB, but after deleting output it is only 192k, and after NTFS compression only 72k. Doing this will require evaluating the documentation page before you can see the examples, but it will easily save 500MB for version 7; probably more in later versions.

    You can modify this answer as per your needs to programmatically delete all the output cells from the notebooks in the Documentation directory.

  2. As Oleksandr suggests you can delete the SystemFiles/Java/<$SystemID> folder(s), which contain copies of the JVM, if you have Java installed separately, saving about 190MB of space. (Or, following point #3, about half that.)

  3. Initial testing indicates that core functionality is retained after deleting binaries for the other system type (32 or 64 bit) from SystemFiles\Kernel\Binaries, SystemFiles\FrontEnd\Binaries and SystemFiles\Converters\Binaries saving about 88MB for version 7.

Under Windows you can use WinDirStat to easily visualize the space allocation within a drive or directory tree. That page recommends KDirStat for Linux and Disk Inventory X for OS X.


Since Windows doesn't display directory sizes for me I wrote a tiny utility to let Mathematica display them in a collapsible tree form (code at the bottom).

I opened up some candidates for deletion, but you should try them first by moving the specific directories out of the MMA directory structure. As Image_doctor said, the documentation is a good sized candidate, as well as the 32/64 bit versions of the binaries suggested by Szabolcs. Further candidates can be found in the Links directory (but don't touch the MathLink directory; many of the others are probably safe, but no guarantee).

Mathematica graphics

directoryTree[startDir_] :=
 Module[{names, dirs, files, sizeFiles, sizeDirs, sons},
  SetDirectory[startDir];
  names = FileNames[];
  dirs = Select[names, (FileType[#] == Directory &)];
  files = Complement[names, dirs];
  sizeFiles = Total[FileByteCount /@ files];
  sons = If[Length[dirs] > 0, directoryTree /@ dirs, {}];
  ResetDirectory[];
  sizeDirs = If[Length[sons] > 0, Total[sons[[All, 2 ;; 3]], 2], 0];
  {startDir, sizeFiles, sizeDirs, sons}
]

dirTreeView[{}] := ""
dirTreeView[dT_] := 
  OpenerView[
    {
     Row[{First[dT], " (", Length[dT[[4]]], ", ", Total@dT[[2 ;; 3]], ")"}], 
     Column[dirTreeView /@ dT[[4]], Frame -> All]
    }
  ]

dirTreeView@directoryTree[$InstallationDirectory]

Half of it appears to be in ../Documentation , you could delete that and look everything up on the Wolfram site on the web