What are the LM_LICENSE_FILE and MLM_LICENSE_FILE environment variables and how do I set or check for them?

857 views (last 30 days)
What are the LM_LICENSE_FILE and MLM_LICENSE_FILE environment variables, what the differences are between them, and how I set or check for them?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 24 Aug 2021
Edited: MathWorks Support Team on 2 Nov 2021
Beginning with MATLAB 6.0 (R12), MLM_LICENSE_FILE can be set to make sure MATLAB is using a specific license file (or server(s) for network licenses). LM_LICENSE_FILE environment variable can also be set to do this, but any FLEXlm application will then use it. MLM_LICENSE_FILE is specific to the MATLAB vendor daemon, MLM, and will not be recognized by other FLEXlm applications.
Note: MATLAB may still read the LM_LICENSE_FILE variable if it is set, before it reads MLM_LICENSE_FILE. One of these variables must be set for clients of a redundant server triad to function properly.
How you find or set these environment variables depends on your Operating System:
1. Open the System Properties window by pressing the Windows key and “R”. This will open the Run window. Type the following Run command:
Then hit enter.
2. Next click the Environment Variables button near the bottom.
3. Under the User variables and System variables, check for a LM_LICENSE_FILE and MLM_LICENSE_FILE variable.
4. Go to New to make one of these variables (this can be set under user or system, depending on the desired usage). The variable name will be:
and the value will either be the full path to the license file or port@host, for example:
C:\Program Files\MATLAB\R2009a\licenses\license.dat
If you are using a redundant server triad, use commas to separate the servers, for example:
Linux/Unix/Mac OS X 10.9 and below
This can be done in the shell using the setenv or export command depending on the shell. You can either type the command in a shell session (which will make it only last for the session) or you can add it to the appropriate file in your home directory (or create that file if it doesn't exist):
.cshrc (for c-shell)
.profile or .bashrc (for bash)
The . before the file means this is a hidden file. To edit this file, you will need to open it up in a basic text editor and add the command (depending on your shell):
Examples, on c-shell:
setenv MLM_LICENSE_FILE "/usr/local/MATLAB/licenses/license.dat"
setenv MLM_LICENSE_FILE "1711@server1"
Examples, on bash:
export MLM_LICENSE_FILE=/usr/local/MATLAB/licenses/license.dat
export MLM_LICENSE_FILE=27000@server1,27000@server2,27000@server3
Please refer to your Operating System documention for more information on setting an environment variable.
Mac OS X 10.10 and above
Apple is in the process of depreciating environment variables, so see this article for a workaround if you are on OS X 10.10 "Yosemite" or higher:
Kyle Perry
Kyle Perry on 18 May 2018
Hello Hasassah,
Depending on what type of license your University is providing you, you may not see a license file in your licenses folder as different license types place license files into different folders.. In this situation, I would recommend contacting MathWorks Installation support so we can help resolve the issue.

Sign in to comment.

More Answers (1)

Régis on 21 Jan 2014
Hello, I'm facing the same issue, due to a conflict with an environment variable (namely "LM_LICENSE_FILE") used by another toolset. The actual license for Matlab is a network one ("network.lic" file), so Matlab is not supposed to use this environment variable. How can I force Matlab to first look for the network license, then for a local one? regards,
Walter Roberson
Walter Roberson on 11 May 2017
Sean Lin comments to Ajay:
This suggestion for me solve Matlab R2016a stuck in "Initializing" mode after Win10 creators update

Sign in to comment.


No tags entered yet.


Community Treasure Hunt

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

Start Hunting!