Clear Filters
Clear Filters

How to set temp folder for MCR Installer

4 views (last 30 days)
Aaron Mailhot
Aaron Mailhot on 4 Aug 2020
Answered: Sanchari about 15 hours ago
I am making a Matlab Compile Runtime application on Linux via 'deploytool', however when I go to deploy/install my application by running the installer deploytool generates, I am unable to do so as it requires write-access to /tmp (which I don't have).
I have tried setting a 'TMP' environment variable to a workable path for me, which does not seem to change this bevahior (it did change it for running deploytool though).
Any help is appreciated, thanks.

Answers (1)

Sanchari
Sanchari about 15 hours ago
Hello Aaron,
When deploying a MATLAB Compiler Runtime (MCR) application on Linux and encountering issues with write access to "/tmp", one can resolve this by setting the "TMPDIR" environment variable to a directory where the user has write access. The "TMP" environment variable may not always be recognized by all processes, but "TMPDIR" is more universally recognized for temporary file storage.
Here are the steps to set the "TMPDIR" environment variable and deploy the application.
Step 1. Create a temporary directory: First, create a directory where one has write access. For example, create a directory in the home directory as follows.
mkdir -p ~/my_temp_dir %sh
Step 2. Set the "TMPDIR" Environment Variable: Set the "TMPDIR" environment variable to point to the directory that was just created. Do this in the terminal session before running the installer.
export TMPDIR=~/my_temp_dir
Step 3. Run the installer: With the "TMPDIR" environment variable set, run the installer generated by "deploytool":
./your_installer.sh
Step 4. Make the change permanent (optional): If wanting to make this change permanent for the user, one can add the "export TMPDIR=~/my_temp_dir" line to the shell's startup file (e.g., "~/.bashrc or ~/.bash_profile" for Bash, "~/.zshrc" for Zsh).
% For example, to add it to ~/.bashrc
echo 'export TMPDIR=~/my_temp_dir' >> ~/.bashrc
source ~/.bashrc
Consider the following points additionally:
  • Permissions: Ensure that the directory that was created has the appropriate permissions so that one can write to it.
  • Environment Variables: Verify that the "TMPDIR" environment variable is correctly set by running "echo $TMPDIR" in the terminal.
Hope this helps!

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!