MATLAB: How to start or stop the Network License Manager

MATLAB

I would like to start or stop the network license manager for my MathWorks products.

Best Answer

The network license manager can be started or stopped using the following methods depending on the OS of the server:
Windows Servers
Option 1: Using LMTOOLS.exe
To use the LMTOOLS Utility (lmtools.exe) to start the license manager, follow this procedure:
1. Navigate in Explorer to $MATLAB\etc\win{32|64} ($MATLAB\flexlm for releases prior to 2010b), where $MATLAB is the MATLAB root directory on your machine, as returned by typing at the MATLAB Command Prompt:
matlabroot
2. Double-click on lmtools.exe.
3. Click on the Start/Stop/Reread tab.
4. Click on the "Start Server" button to start the license manager, or the "Stop Server" button to stop it.
Option 2: Using Windows services
While LMTOOLS is the recommended method, it is also possible to start and stop the license manager using the Windows services applet. To do so:
1. Navigate to the "Services" control window. Generally this is listed as an item under "Administrative Tools" under the "Control Panel."
2. Locate the "MATLAB License Server" service. If you have manually created the service, locate the name of that service instead.
3. Double-click the service to bring up the Properties window, and use the appropriate buttons to Stop, Start, Restart, Pause, or Resume the License Manager.
Option 3: Start the license manager as an application via command prompt
It is also possible to start the license manager using the DOS (command) prompt. To do so, follow this procedure:
1. Open up a Windows Command Prompt by clicking on the Start Menu and go to All Programs, Accessories, and click on Command Prompt.
2. Change directories in the prompt to the $MATLAB\etc\win{32|64} ($MATLAB\flexlm for releases prior to 2010b) directory, where $MATLAB is the MATLAB root directory on your machine, as returned by typing at the MATLAB Command Prompt:
matlabroot
For example, if the license manager was installed with release R2019a the command would be:
cd "C:\Program Files\MATLAB\R2019a\etc\win64"
3. Type the following command:
lmgrd -c <PATH_TO_LICENSE_FILE> -l <PATH_TO_LOG_FILE>
For example,
lmgrd -c license.dat -l lmlog.txt
NOTE: To stop the license manager when started in this method, you will need to manually kill the lmgrd.exe process that is started through Windows Task Manager.
Unix/Linux/Mac Systems
For Unix/Linux/Mac OS X, the license manager is started and stopped through the terminal. For Mac OS X, Terminal can be launched from Applications/Utilities. Once you have a terminal window, the license manager can be started and stopped using the methods below:
Option 1: Using the license manager binaries
1. Change directories in the terminal to $MATLAB/etc (where $MATLAB is your root MATLAB directory, as found by typing matlabroot at the MATLAB Command Prompt. For example, for R2019a on Mac OS X this directory will be /Applications/MATLAB_R2019a.app/etc and the command would be:
cd /Applications/MATLAB_R2019a.app/etc/maci64
For Linux systems, (assuming the license manager was installed in the default location) the command would be;
cd /usr/local/MATLAB/R2019a/etc/glnxa64
2. To start/restart the license manager, use the lmgrd script with the command:
lmgrd -c <PATH_TO_LICENSE_FILE> -l <PATH_TO_LOG_FILE>
For both Mac and Linux, the Syntax is the same as it is running the manager from Command Line on Windows (see above for an example).
3. To stop the license manager, use the lmdown script with the command:
./lmdown
If you require a force stop the license manager, you can run the command:
./lmdown -force
NOTE: We recommend clearing the MathWorks log files found under /var/tmp before restarting the license manager under Unix/Linux/Mac OS X for versions of the license manager prior to 11.6.
Option 2: Using Boot Scripts
The license manager can also be stopped and started using the boot scripts. For more information on how to start or stop the license manager using the boot scripts, see the Related Solution " How to I get the network license manager to start at boot time?"
NOTE: For Mac OS X 10.6, there is a bug that prevents normal startup of the license manager. See the bug report here for more details: