MATLAB: What is the license file search path for MATLAB

MATLAB

What is the order that MATLAB will use to search for licenses as of MATLAB R2008a or later?

Best Answer

MATLAB will search for licenses in the following order:
1) Any license files or license servers specified with the -c startup flag override all other entries on the license search path.
2) MATLAB will check against the environment variables MLM_LICENSE_FILE or LM_LICENSE_FILE. (LM_LICENSE_FILE is checked first if both are set)
3) MATLAB will check against the registry keys:
HKEY_LOCAL_MACHINE\Software\FLEXlm License Manager\MLM_LICENSE_FILE
HKEY_LOCAL_MACHINE\Software\FLEXlm License Manager\LM_LICENSE_FILE
Or on Unix, it will check for /home/$USER/.flexlmrc
4) MATLAB will check the user's USERPROFILE/HOME location:
MATLAB will first search the $APPDATA\MathWorks\MATLAB\$VER_licenses folder (for Windows), and /home/$USER/.matlab/$VER_licenses (for macOS/Linux). Where:
$APPDATA is the Windows User Application Data location (obtained from navigating to %APPDATA% in explorer)
$USER is the username on the machine
$VER is the folder for the MATLAB version (ex: R2020a)
For example, this will be:
C:\Users\username\AppData\Roaming\MathWorks\MATLAB\R2021a_licenses\
or /home/user/.matlab/R2021a_licenses/
5) Lastly, MATLAB will check in the "licenses" folder under the MATLAB installation. For example:
C:\Program Files\MATLAB\R2021a\licenses (Windows)
/Applications/MATLAB_R2021a/licenses (macOS)
/usr/local/matlab/licenses (Linux)
MATLAB will search for a license.dat first and then any .lic in alphabetical order.