Main Content

Borrow Licenses

License Borrowing Overview

To provide license mobility, MathWorks® supports license borrowing.

  • This capability lets you use MathWorks products on computers that do not have a continuous connection to the license server.

    After you borrow a license, you can disconnect your computer from the network and continue to use the products you have checked out until the borrow period expires.

    You can also return a borrowed license early.

  • Commercial Concurrent and Network Named User licenses can use license borrowing.

  • The maximum borrow period is 30 days (720 hours).

  • MathWorks products must be installed on client computers where the borrowed license will be used.

Note

Campus-Wide licenses, including Concurrent licenses, cannot use license borrowing.

Enable License Borrowing

You must be an Administrator of the license to enable license borrowing.

  1. Request that borrowing be enabled on your license from MathWorks. To request this change, go to the MathWorks website at https://www.mathworks.com and click Support. On the support page, click Contact support.

    Notes

    • In license files with borrowing, the INCREMENT lines for products include the keyword BORROW=720, where 720 is the maximum number of hours in the borrow period (you cannot change this value). For example:

      INCREMENT MATLAB MLM 17 30-jan-2025 5 52FCH63184G5 BORROW=720 \
      DUP_GROUP=UH SN=220668

    • The maximum borrow period of 720 hours is equal to 30 days.

    After your license is enabled for borrowing, you will download a new license file.

  2. On your license server, stop the network license manager.

  3. On your license server, copy the SERVER and DAEMON lines from the existing license file, matlabroot/etc/license.dat, where matlabroot represents your MATLAB® installation folder. For example, here are the SERVER and DAEMON lines from a license file:

    SERVER mysystem 0012110gbc86 27000
    DAEMON MLM C:\Program Files\MATLAB\R2024a\etc\win64\MLM.exe
  4. Paste the SERVER and DAEMON lines that you copied from your existing license file at the top of the new license file that includes the license borrowing capability.

  5. On your license server, replace the existing license file with the new license file.

  6. Restart the network license manager.

Turn on Borrow Products Menu Option

Note

Ensure that the client computer has a network connection to the license server.

To turn on the menu option for Borrow Products in the Licensing menu:

  1. On the client computer, start MATLAB and enter this command:

    matlab.internal.licensing.enableBorrowUI(true)

    After you turn on the menu option for License Borrowing the first time, it remains available any time you start MATLAB.

  2. Restart MATLAB.

  3. Locate the Borrow Products option in the Licensing menu.

    1. On the Home tab, in the Resources section, click Help.

    2. Under Licensing, look for Borrow Products.

    MATLAB ribbon navigation showing Help pull down option Licensing and Licensing option Borrow Products

Borrow Product Licenses by Selecting Products

To borrow licenses by product name:

  1. Start MATLAB.

  2. On the Home tab, in the Resources section, click Help.

  3. Under Licensing, click Borrow Products.

  4. Select Borrow selected products by choosing from a list. The dialog box displays the products that can be borrowed.

  5. Specify the borrow period: from 1 day (default) to 30 days.

  6. Click the check box next to each product that you want to borrow.

  7. Click Borrow.

  8. Close MATLAB.

  9. Disconnect your computer from the network.

When you reopen MATLAB, your borrowed products can be used away from your network.

Continue using the borrowed products until the borrow period expires. If you reconnect to your network before the end of the borrowing period, see Return Borrowed Licenses Early.

Borrow Product Licenses Automatically

To borrow product licenses automatically:

  1. Start MATLAB.

  2. On the Home tab, in the Resources section, click Help.

  3. Under Licensing, click Borrow Products.

  4. Select Borrow products automatically as you work with them.

  5. Specify the borrow period: from 1 day (default) to 30 days.

  6. Click Turn On Auto Borrow.

  7. Work in MATLAB as you would normally, performing the tasks you want to perform when you are disconnected from the network. As you use products, MATLAB borrows the licenses for them automatically.

    When you have finished working with all the products you want to borrow, click Turn Off Auto Borrow.

  8. Close MATLAB.

  9. Disconnect your computer from the network.

When you reopen MATLAB, your borrowed products can be used away from your network.

Continue using the borrowed products until the borrow period expires. If you reconnect to your network before the end of the borrowing period, see Return Borrowed Licenses Early in the next section.

Return Borrowed Licenses Early

To return a borrowed license early:

  1. Connect your computer to your network.

  2. On the Home tab, in the Resources section, click Help.

  3. Under Licensing, click Borrow Products.

    Borrowing UI showing Return borrowed products early as selected and MATLAB Compiler as product selected

  4. Select Return borrowed products early. The dialog box displays a list of currently borrowed products.

  5. Specify the product licenses you want to return early. By default, all borrowed product licenses are selected. Deselect any products you do not want to return.

  6. Click Return.

Note

You cannot borrow licenses and then return them in the same MATLAB session. You must quit MATLAB and restart it before you can return the licenses.

Manage License Borrowing

Use an options file to control license borrowing behavior. Use the network license manager tools to monitor which licenses are borrowed.

Determine Which Licenses Are Currently Borrowed

The network licensing manager provides tools that you can use to monitor the status of borrowed licenses in your network configuration. You can use the LMTOOLS application or the lmstat command.

Use LMTOOLS Application on Windows Systems

  1. Log in to your license server.

  2. Navigate to the matlabroot\etc\win64 folder, where matlabroot represents the name of your MATLAB installation.

  3. Start the LMTOOLS application by double-clicking the lmtools.exe executable file.

  4. Select the Server Status tab in the LMTOOLS dialog box.

  5. Click the Perform Status Enquiry button. LMTOOLS displays the status information in the output window. In the status information, each entry in the list for a product shows the total number of licenses for the product and tells how many licenses are currently checked out. For borrowed licenses, the entry for the product includes the keyword (linger:XXX), where XXX specifies the borrow period in seconds.

    lmutil - Copyright (c) 1989-2018 Flexera. All Rights Reserved.
    Flexible License Manager status on Thu 12/9/2021 15:43
    
    [Detecting lmgrd processes...]
    License server status: 27000@myserver
        License file(s) on myserver: C:\Program Files\MATLAB\R2024a\etc\license.dat:
    
    myserver: license server UP (MASTER)inclusivetermexception v11.16.2
    
    Vendor daemon status (on myserver):
    
           MLM: UP v11.16.2
    Feature usage info:
    
    Users of MATLAB:  (Total of 13 licenses issued;  Total of 1 license in use)
    
      "MATLAB" v46, vendor: MLM, expiry: 30-jan-2025
      vendor_string: vi=0:at=200:ae=1:lu=300:lo=CN:ei=1234567:lr=1:ep=0:
      floating license
    
        juser myserver DESKTOP-4SPTFG0 (v45) (myserver/27000 102), start Thu 12/9 15:41
    
    Users of SIMULINK:  (Total of 1 license issued;  Total of 0 licenses in use)
    
    
    Users of Compiler:  (Total of 1 license issued;  Total of 1 license in use)
    
      "Compiler" v46, vendor: MLM, expiry: 30-jan-2025
      vendor_string: vi=0:at=200:ae=1:lu=300:lo=CN:ei=1234567:lr=1:ep=0:
      floating license
    
        juser myserver DESKTOP-4SPTFG0 (v45) (myserver/27000 201), start Thu 12/9 15:43  (linger: 807316 / 807360)
    

    Note

    MATLAB Compiler™: License status information may contain linger even when MATLAB Compiler is not being borrowed.

Use lmstat Utility on Windows Systems

  1. Log in to your license server and open a DOS command window. One way to open the DOS command window is to select the Run option from the Start menu, type cmd in the text entry field, and then click OK.

  2. Navigate to the matlabroot\etc\$ARCH folder, where matlabroot represents the name of your MATLAB installation and $ARCH represents a platform-specific folder.

  3. Run the lmutil command specifying lmstat as an argument. (On Windows® computers, FlexNet® packages all its license management utilities into one program, lmutil.)

    The following example uses the -a option to display all the information returned by lmstat. Note that you must also use the -c option to specify the name of your license file. For more information about lmstat, see the FlexNet End User’s Guide.

    lmutil lmstat -a -c "C:\Program Files\MATLAB\R2024a\etc\license.dat"

In the status information returned by lmstat, each entry in the list for a product shows the total number of licenses for the product and tells how many licenses are currently checked out. For borrowed licenses, the entry for the product includes the keyword (linger:XXX), where XXX specifies the borrow period in seconds.

"Control_Toolbox" v46, vendor: MLM
floating license
carlostessier lm-server lm-server (v46) (lm-server/27000 201), start Fri 12/17 14:37
(linger: 121500)

Note

MATLAB Compiler: License status information may contain linger even when MATLAB Compiler is not being borrowed.

Use lmstat on Linux Systems

  1. Log in to your license server.

  2. Navigate to the matlabroot/etc directory, where matlabroot is your MATLAB installation folder.

  3. Run the lmstat utility.

    lmstat -a -c /usr/local/MATLAB/R2024a/etc/license.dat

Control License Borrowing with Options Files

You can control various aspects of license borrowing behavior using an options file for the network license manager. An options file is a text file that contains option statements. Each option statement begins with a keyword that identifies the option. The following table lists the options you use to control aspects of license borrowing. For more information about these options, see the FlexNet End User’s Guide. To see an example of an options file, see the example in the next topic.

TaskOption to Specify

Reserve a specific number of licenses that cannot be borrowed.

Use the BORROW_LOWWATER option.

For example, to make sure that three MATLAB licenses can never be borrowed, use this syntax:


BORROW_LOWWATER MATLAB 3

Specify which users can borrow licenses for a particular product.

Use the INCLUDE_BORROW option.

For example, to allow the user Fred to borrow a license for the Image Processing Toolbox™, use this syntax:


INCLUDE_BORROW Image_Toolbox USER fred


Note: When you specify that a particular user can borrow licenses, you exclude all other users.

Specify which users cannot borrow licenses for a particular product.

Use the EXCLUDE_BORROW option.

For example, to prevent the user Donna from borrowing a license for the Image Processing Toolbox, use this syntax:


EXCLUDE_BORROW image_toolbox USER donna

Specify the maximum amount of time a user can borrow a license.

Use the MAX_BORROW_HOURS option.

For example, to limit users of the Image Processing Toolbox to a three day borrow period, use this syntax:


MAX_BORROW_HOURS image_toolbox 72


The borrow period you specify must be less than 30 days, which is the borrow period specified in borrow-enabled licenses from MathWorks.

Example: Exclude a User from Borrowing a License

To illustrate using an options file to control license borrowing behavior, this example uses an options file to exclude a user from borrowing a license for a specific product:

  1. Create the options file.

    An options file is a text file that contains options statements. Using any text editor, create a file that contains the following line. You can give the options file any name and store it in any convenient folder.

    EXCLUDE_BORROW SIMULINK USER fred
  2. Specify the name of the options file on the DAEMON line in your license file.

    On your license server, use any simple text editor to edit your license file, adding the options= keyword to the DAEMON line, as follows. Be sure to use the line continuation character (\) if the DAEMON line extends beyond a single line.

    DAEMON MLM C:\Program Files\MATLAB\R2024a\etc\win64\MLM.exe \
    options=C:\myborrowoptions.opt
  3. Start (or restart) the network license manager so that it processes the options file.

After setting up this options file, test it:

  1. Log in as the user Fred.

  2. Start MATLAB.

  3. Use the Borrow Products menu to select Simulink® for borrowing.

    You should get the following error:

    License Manager Error -38.
    User/host on EXCLUDE list for feature
    Feature: SIMULINK
    License path: C:\Program Files\MATLAB\bin\win64\license.dat;
    C:\Program Files\MATLAB\bin\win64\*.lic

Related Topics