My Mathematica installation (V11 on Linux Mint 17.3) has created a 3GB directory ".Mathematica" in my home directory. Is there any point in backing this up or will it just be recreated if I deleted it (at the cost of some extra downloads)?

Most of the space is in the "Paclets" subdirectory, which presumably will be regenerated if needed.

However, are there any parts of this directory I should be worried about losing? If so, how should I manage backup and restore operations?

  • $\begingroup$ You mean the one in home/username ? I have one of them in Manjaro, Kubuntu, but they are less than 2 MB. $\endgroup$
    – bobbym
    Dec 31 '16 at 18:32
  • 1
    $\begingroup$ Likely most of the space is taken by the Paclets subdirectory and these will be redownloaded automatically as needed. $\endgroup$
    – ilian
    Dec 31 '16 at 21:41

The directory you are mentioning is what $UserBaseDirectory on a linux machine usually is set to. AFAIK the content of that is identical (despite some subdirectories for OS specific binaries) for other OS. There is also a similar directory $BaseDirectory which will contain similar data for all users on that system.

Here is a description of some of the subdirectories that I found on my machine as far as I understand them:

  • ApplicationData: resereved for Mathematica packages/applications which need to store data.
  • Applications: default directory for any packages you install. You might want to have a backup of those, although you also could reinstall.
  • Autoload: same as Applications, except that packages within this directory will be auto loaded.
  • DatabaseResources: contains data of the DatabaseLink` package. It looks like that would nowadays probably go into ApplicationData and is there for historic/compatibility reasons.
  • FrontEnd: mainly contains an init.m which contains the permanent settings that you set with the user interface. You want to have a backup to restore your settings.
  • Kernel: similar to FrontEnd, but contains initialization for the Kernel. Some Packages auto edit this, but it mainly allows you two evaluate your own code at Kernel startup, for which case you want a backup. If a package writes there it might be necessary to either backup both package and this or none of them to avoid inconsistencies...
  • Knowledgebase: contains some data that looks like cached data which will be regenerated when it does not exists. Most probably not something you would backup.
  • Licensing: might contain information about your license (if not set on a per machine level in $BaseDirectory), if not available Mathematica will ask for it on startup. You might want to backup this.
  • Paclets: contains both paclets ("new style packages/addons") that you did install and data that the data-functions provide. So it is a mixture of stuff that you might want to have in a backup and mostly (considering amount of data) stuff that will be regenerated.
  • SearchIndices: contains indices that you create with the (still experimental) CreateSearchIndex functions (I think).
  • SystemFiles: contains some internal data like a history of how often you used which function, but also contains e.g. palettes that you did install with the "Palettes" -> "Install Palette" menu entry.
  • Temp: looks very much like temporary data that won't go to a backup.

Of course the above list is not complete and my understanding of the potential contents of these subdirectories is neither complete nor authoritative. I invite everyone to add to the list and correct my mistakes.

The unfortunate conclusion is that it is not that easy to give a simple strategy for what parts you would typically put into a backup as some of the directories might contain data which should go to a backup and also data that shouldn't. The Paclets subdirectory seems to be the most problematic as it might contain large amounts of data that shouldn't be in a backup (data downloaded from WRI servers to make the data functions work which will be regenerated when absent) but also contains installed paclets which you might want to have in a backup to not have to reinstall.

Another thing worth mentioning is that I think some of the directory names might have changed and might change in the future depending on the version you are using. There is also both a "Wolfram" and a "Wolfram Research" subdirectory parallel to the "Mathematica" directory that $UserBaseDirectory points to on my windows machine (probably look for ".Wolfram" and ".Wolfram Research" on a linux machine) and which contain subdirectories "SearchIndices" and "Plugin" that seem to serve similar purposes as some of the subdirectores in $UserBaseDirectory.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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