This Answer applies to a local installation of MATLAB. It does not apply to Docker installations of MATLAB. In each of the folders mentioned, MATLAB will search for a license.dat first and then any .lic file in alphabetical order.
The order that MATLAB will look at license files for MATLAB Desktop is as follows. #1 Is the first path MATLAB looks at, while #7 is the last:
- License_info.xml
- Specified license file/server
- Registry keys (Windows only)
- .flexlmrc directory (Linux and macOS only)
- Environment variables
- User-specific license folders
- Installation-specific license folders
If there is a license_info.xml file in MATLAB's installation "licenses" folder or in the user-specific licenses folder, then MATLAB will look at this file and only this file for licensing. This also applies to licensing modes that specify "online" or "onlinelicensing" (usage example: matlab -licmode onlinelicensing).
If you point MATLAB to a specific license file or server with the -c argument, MATLAB will only look at the license file or license server specified with the -c argument. It will skip any of the next licensing paths it would look at (points 3-7.)
Either registry key will be checked to see if it points to a license file or license server:
- HKEY_LOCAL_MACHINE\Software\FLEXlm License Manager\MLM_LICENSE_FILE
- HKEY_LOCAL_MACHINE\Software\FLEXlm License Manager\LM_LICENSE_FILE
On Linux and macOS, MATLAB will look for a directory named .flexlmrc in the user's home directory (/home/$USER or ~). If the directory exists, it will look for license files in here.
MATLAB will check for environment variables MLM_LICENSE_FILE and LM_LICENSE_FILE to see if they are pointing to a license file or license server.
Each installation of MATLAB has a licenses folder that is user-specific. This exact location varies between platform and release.
Windows
%appdata%\MathWorks\MATLAB\R20XXy_licenses
ex: C:\Users\james\AppData\Roaming\MathWorks\MATLAB\R2024b_licenses\
Linux
~/.matlab/R20XXy_licenses
ex: /home/james/.matlab/R2024b_licenses/
macOS
~/Library/Application Support/MathWorks/MATLAB/R20XXy_licenses
ex: /Users/$USER/Library/Application Support/MathWorks/MATLAB/R2024b_licenses
MATLAB has a licenses folder it will check for license files. Its exact location will vary depending on where you installed MATLAB. Below are some examples for each platform, when MATLAB is installed in the default location:
Windows
C:\Program Files\MATLAB\R20XXy\licenses
macOS
/Applications/MATLAB_R20XXy/licenses
Linux
/usr/local/MATLAB/R20XXy/licenses