Message Boards Message Boards


Redirect temporary files to an external disk?

Posted 8 months ago
3 Replies
2 Total Likes

Many times Mathematica aborts because there is no more space available on disk. Presumably this is due to the temporary files that it creates and needs for its calculations. If I were to install a large disk on my Macintosh for all the space required by Mathematica, how can I tell it to address all its temporary files and swapping to that extra disk?

I do not wish to reinstall Mathematica on an external disk. I wish to maintain the rest of Mathematica's files in my current disk, and send only the temporary files to a secondary disk.

3 Replies

Mathematica uses the Temp directory that is installed in the system. To find out the path to this directory, ask in Mathematica


To change this path, you need to change the path of the system temp directory. For a Windows user this is very simple. See Control Panel\System and Security\System -> Advanced system settings->Environment Variables->Edit TEMP, Edit TMP After all the changes we have:

In[1]:= $TemporaryDirectory

Out[1]= "D:\\Temp"

This would redirect temporary files from all software to that directory. Is there a way to redirect only Mathematica's temporary files?

SetEnvironment[{"TEMP" -> "D:\\Temp", "TMP" -> "D:\\Temp"}]
 In[]:= GetEnvironment[{"TEMP", "TMP"}]

Out[]= {"TEMP" -> "D:\\Temp", "TMP" -> "D:\\Temp"}
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract