MATLAB Answers

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

1,398 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 31 May 2017
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:
Windows
1. Open the System Properties window by pressing the Windows key and “R”. This will open the Run window. Type the following Run command:
SystemPropertiesAdvanced
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:
MLM_LICENSE_FILE
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
or
If you are using a redundant server triad, use commas to separate the servers, for example:
1711@server1,1711@server2,1711@server3
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:

  2 Comments

Hadassah Fromowitz
Hadassah Fromowitz on 17 May 2018
I downloaded MATLAB using a student license from my university. My C:\Program Files\MATLAB\R2018a\licenses does not have a licenses.dat file, it only has a .bin file. Could this be the reason MATLAB is initializing for a long time and then showing “busy” after the first command? If so, any suggestions for how I can fix this? Thanks in advance
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.
www.mathworks.com/support/contact_us/

Sign in to comment.

More Answers (1)

Régis
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,

  8 Comments

Show 5 older comments
Scott
Scott on 4 Oct 2016
Is there any practical difference between using MLM_LICENSE_FILE, and using a semicolon-separated list of license files in LM_LICENSE_FILE?
If I already have other FlexNet software on my machine, I would think that manipulating the list of license files in LM_LICENSE_FILE would give me more flexibility to define the order that I "hit" the license servers.
Kyle Perry
Kyle Perry on 15 Nov 2016
It is good practice and recommended to use the vendor specific environment variables to keep programs and how they interact with license servers separate. It can also be helpful later on in troubleshooting situations to use the MLM instead of LM.
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.

Sign in to answer this question.

Tags

No tags entered yet.

Products