How can I change the temp directory the MATLAB installer uses?

237 views (last 30 days)
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?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 24 Mar 2022
Edited: MathWorks Support Team on 20 Dec 2021
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.
Run Command Prompt
Drag the extracted setup.exe into command prompt to create the path.
At the end of the path, type "-tmpdir" followed by the path to the desired folder. 
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.
For example:
setup.exe -downloadFolder C:\Users\%USERNAME%\Downloads\Temp\ -tmpdir D:\Temp\
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.
For example:
./install -downloadFolder /home/<USERNAME>/Downloads/temp -tmpdir /usr/temp
Note: As of the R2021b installer, changing the directory will not work with the above instructions. You will need to set the environment variable TMPDIR to another directory. The following article can be used to guide you through the process of creating a environment variable:
How do I set add or change environment variables?
Eli Ankri
Eli Ankri on 2 Jul 2021
Can someone please explain to me the steps? I am so confused by how to do it

Sign in to comment.

More Answers (8)

Grey Christoforo
Grey Christoforo on 29 Jan 2020
Edited: Grey Christoforo on 30 Jan 2020
These options are not even documented in the installer_input.txt or install_guide.pdf files that I expect to detail all the installer's configuration options. Why are these important parameters being kept secret?
/tmp is a ram disk on many systems[1] and by default the installer is downloading ~10+ of gigabytes into that (depenging on what toolboxes are being installed). Am I missing something? This design seems like its asking for trouble on a lot of situations. Using /var/tmp by defualt may be a good alternative.
Grey Christoforo
Grey Christoforo on 30 Jan 2020
That doesn't match with how I can verify that installer_input.txt operates today.
installer_input.txt seems to contain the _option_ for telling the installer to run in silent mode. Other options in that file do not need silent mode to operate properly. For example, if you put your file instiallation key into the installer_input.txt file and run the installer with it, that key gets auto populated in the installer gui and the gui installer runs as expected otherwise.

Sign in to comment.

Ho Sean
Ho Sean on 15 Apr 2020
This option (-tmpdir) not works in R2020a installer, is there something wrong? or should I disable tmpfs.mount feature in Linux system?
Benjamin Herne
Benjamin Herne on 6 Aug 2020
The joys of closed-source software - change what you want, when you want, and dont tell the consumer, because theyve already paid. You are in complete control, with no checks and balances from the community.

Sign in to comment.

Ilya Shipachev
Ilya Shipachev on 4 May 2020
Your solution worked for me. The problem also that Matlab2020a is delivered as .exe installer, but not the setup.exe file. So I had to cancell the installation again after unzipping and go manually to the folder through command line.
I would mention quite popular case I have: Windows installed to the disk C. Disk size is picked around 50Gb to fit all system needs but still running out of space, even though I'm using different disk to install programs and store my files.
I didn't have 10Gb free space on disk C. So I was quite surprised that Matlab is running out of space on disk C when I've picked disk F as an installation location. Some options to pick temporary folders would be nice I think.

Nehemiah Mork
Nehemiah Mork on 28 Sep 2020
If anyone is getting a location error when trying to open matlab (version 2020b) when using the command window do this.
D:\....path...\setup.exe -downloadFolder D:\....location to download
worked for me to download but then when I would try and open Matlab it would say matlab is not where it should be and would give me a location error and would not open. What I ended up having to do is go into windows control panel and change where my temporary files were stored and change them from a C:\ drive file to a D:\ drive file so they were being saved in the same driver as where I was installing matlab so I did not get that location error. If anyone is also getting that error watch this youtube video on how to change your temporary save location from C:\ drive to D:\ drive.

Sign in to comment.

Jesús Vicente Gil Borrás
I don't istaler Matlab

Radek on 8 Oct 2021
The -tmpdir and/or -downloadFolder flags does not work with r2021b installer on Linux.
Installer will always download the files into /tmp no matter what. What a pain...

Abdikarimhassan on 11 Jun 2022
how getting lisens number

Abdikarimhassan on 11 Jun 2022


No tags entered yet.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!