MATLAB: How to change the temp directory the MATLAB installer uses

MATLAB

I am installing MATLAB but the installer cannot run to completion because my /tmp folder is not large enough. Is there anyway I can bypass using /tmp or switch the directory?

Best Answer

The -tmpdir installer flag can be used to change the directory where temporary files are created and deleted during installation.
Warning: If you set the directory or folder without specifying a subfolder to place the temporary files, the -tmpdir installer flag will delete everything inside the directory or folder.
Windows:
Run Command Prompt
Drag the extracted setup.exe into command prompt to create the path.
At the end of the path type, "-tmpdir \path\to\tempfolder\"
As of R2018b, the downloaded archive files will also be in tmp folder. You will also need to use the -downloadFolder flag as well as the -tmpdir flag.
setup.exe -downloadFolder \path\to\download\destination -tmpdir \path\to\installation\destination
Linux and Mac:
$ ./install -tmpdir /path/to/installation/destination
Log files will still be placed into the /tmp directory and not into the directory specified in -tmpdir. As of R2018b, the downloaded archive files will also be in tmp folder. You will also need to use the -downloadFolder flag as well as the -tmpdir flag.
./install -downloadFolder /path/to/download/destination -tmpdir /path/to/installation/destination