Main Content

Install and Configure MATLAB Runtime

Supported Platforms: Windows®, Linux®, macOS

MATLAB® Runtime contains the libraries needed to run compiled MATLAB applications on a target system without a licensed copy of MATLAB.

Download MATLAB Runtime Installer

Download the MATLAB Runtime installer using one of the following options:

  • Download the MATLAB Runtime installer at the latest update level for the selected release from the website at https://www.mathworks.com/products/compiler/matlab-runtime.html. This option is best for end users who want to run deployed applications.

  • Use the MATLAB function compiler.runtime.download (MATLAB Compiler) to download the MATLAB Runtime installer matching the version and update level of MATLAB from where the command is executed. If the installer has already been downloaded to the machine, it returns the path to the MATLAB Runtime installer. If the machine is offline, it returns a URL to the MATLAB Runtime installer. This option is best for developers who want to create application installers that contain MATLAB Runtime.

Note

If you want to install MATLAB Runtime to a shared network drive, see Run Applications Using a Network Installation of MATLAB Runtime (MATLAB Compiler).

Install MATLAB Runtime Interactively

To install MATLAB Runtime:

  1. Extract the archive containing the MATLAB Runtime installer. The release part of the installer file name (_R2022b_) changes from one release to the next.

    PlatformSteps
    Windows

    Unzip the MATLAB Runtime installer.

    Right-click the ZIP file MATLAB_Runtime_R2022b_win64.zip and select Extract All.

    Linux

    Unzip the MATLAB Runtime installer at the terminal using the unzip command.

    For example, if you are unzipping the R2022b MATLAB Runtime installer, at the terminal, type:

    unzip MATLAB_Runtime_R2022b_glnxa64.zip

    macOS

    Unzip the MATLAB Runtime installer at the terminal using the unzip command.

    For example, if you are unzipping the R2022b MATLAB Runtime installer, at the terminal, type:

    unzip MATLAB_Runtime_R2022b_maci64.zip

  2. Start the MATLAB Runtime installer.

    PlatformSteps
    Windows

    Double-click the file setup.exe from the extracted files to start the installer.

    Linux

    At the terminal, type:

    sudo -H ./install

    Note

    You may need to allow the root user to access the running X server:

    xhost +SI:localuser:root
    sudo -H ./install
    xhost -SI:localuser:root

    sudo is only required if you install to a directory that you do not have write access to.

    macOS

    At the terminal, type:

    ./install

    Note

    You may need to enter an administrator user name and password after you run ./install.

  3. When the MATLAB Runtime installer starts, it displays a dialog box. Read the information and then click Next to proceed with the installation.

  4. In the Folder Selection dialog box, specify the folder where you want to install MATLAB Runtime.

    Note

    You can have multiple versions of MATLAB Runtime on your computer, but only one installation for any particular version. If you have an existing installation of the same version, the MATLAB Runtime installer does not display the Folder Selection dialog box because it overwrites the existing installation in the same folder.

  5. Confirm your choices and click Next.

    The MATLAB Runtime installer starts copying files into the installation folder.

  6. On Linux and macOS platforms, after copying files to your disk, the MATLAB Runtime installer displays the Product Configuration Notes dialog box. This dialog box contains information necessary for setting your path environment variables. Copy the path information from this dialog box, save it to a text file, and then click Next.

    For instructions on setting the path environment variables, see Set MATLAB Runtime Path for Deployment (MATLAB Compiler).

  7. Click Finish to exit the installer.

Default Install Folder

The default MATLAB Runtime installation folders for R2022b are specified in the following table:

Operating SystemMATLAB Runtime Installation Folder
WindowsC:\Program Files\MATLAB\MATLAB Runtime\R2022b
Linux/usr/local/MATLAB/MATLAB_Runtime/R2022b
macOS/Applications/MATLAB/MATLAB_Runtime/R2022b

Install MATLAB Runtime Noninteractively

If you have many installations to perform, you can specify installation arguments as command-line arguments or in an installer control file to save time and prevent errors. When you specify installation arguments, the MATLAB Runtime installer runs as a background task and does not display any dialog boxes.

When running noninteractively, the installer overwrites the installation location.

Caution

On Linux and macOS systems, the installer displays information necessary for setting your environment variables in the Product Configuration Notes dialog box. If you use the installer noninteractively, you must locate your MATLAB Runtime installation directory in order to set the library path after installation. For more information, see Set MATLAB Runtime Path for Deployment (MATLAB Compiler).

Run Installer in Silent Mode

To install MATLAB Runtime in silent mode:

  1. Extract the contents of the MATLAB Runtime installer archive to a temporary folder.

  2. In your system command prompt, navigate to the folder where you extracted the installer.

  3. Run the MATLAB Runtime installer, specifying the -agreeToLicense yes option on the command line.

    Note

    On most platforms, the installer is located at the root of the folder into which the archive was extracted. On 64-bit Windows, the installer is located in the archive bin folder.

    PlatformCommand
    Windowssetup -agreeToLicense yes
    Linux

    sudo ./install -agreeToLicense yes

    Note

    sudo is only required if you install to a directory you do not have write access to.

    macOS./install -agreeToLicense yes

    Note

    If you do not include -agreeToLicense yes as the first option, the installer will not install MATLAB Runtime.

  4. View a log of the installation.

    • On Windows systems, the installer creates a log file named mathworks_username.log, where username is your Windows login name, in the location defined by your TEMP environment variable.

    • On Linux and macOS systems, the installer displays the log information at the command prompt. It also saves it to a file if you use the -outputFile option.

Customize Noninteractive Installation

When run noninteractively, the installer uses the default values unless you specify otherwise. Like the MATLAB installer, the MATLAB Runtime installer accepts a number of command-line options that modify the default installation properties.

The MATLAB installer archive includes an example installer control file called installer_input.txt. This file contains all of the options available for a full MATLAB installation. The MATLAB Runtime installer only accepts the options listed in this section.

To specify options on the command line, separate each option and its value with a space. For example, on Linux:

./install -agreeToLicense yes \
-outputFile myapp_log.txt -destinationFolder ~/MW/MATLAB_Runtime

OptionDescription
-agreeToLicenseAgree to the MATLAB Runtime license.
-destinationFolderSpecifies where MATLAB Runtime is installed.
-outputFileSpecifies where the installation log file is written.
-tmpdir

Specifies where temporary files are stored during installation.

Caution

The installer deletes everything inside the specified folder.

-inputFileSpecifies an installer control file that contains your command-line options and values. Omit the dashes and put each option and value pair on a separate line.

Install MATLAB Runtime without Administrator Rights

On Linux, to install MATLAB Runtime without sudo privileges, select a folder that you have write access to during installation.

On Windows, to install MATLAB Runtime as a user without administrator rights:

  1. Install MATLAB Runtime on a Windows machine where you have administrator rights.

  2. Copy the folder where MATLAB Runtime was installed to the machine without administrator rights. You can compress the folder into a zip file for distribution.

  3. On the machine without administrator rights, add the <MATLAB_RUNTIME_INSTALL_DIR>\runtime\arch directory to the user’s PATH environment variable. For more information, see Set MATLAB Runtime Path for Deployment (MATLAB Compiler).

Install Multiple MATLAB Runtime Versions on Single Machine

MCRInstaller supports the installation of multiple versions of MATLAB Runtime on a target machine. This capability allows applications compiled with different versions of MATLAB Runtime to execute side by side on the same machine.

If you do not want multiple MATLAB Runtime versions on the target machine, you can remove the unwanted ones. On Windows, run Add or Remove Programs from the Control Panel to remove a specific version. On Linux, manually delete the unwanted MATLAB Runtime directories. You can remove unwanted versions before or after installation of a more recent version of MATLAB Runtime because versions can be installed or removed in any order.

Note

Installing multiple versions of MATLAB Runtime on the same machine is not supported on macOS.

MATLAB and MATLAB Runtime on Same Machine

To test your deployed component on your development machine, you do not need an installation of MATLAB Runtime. The MATLAB installation that you use to compile the component can act as a MATLAB Runtime replacement.

You can install MATLAB Runtime for debugging purposes.

Modify Path

If you install MATLAB Runtime on a machine that already has MATLAB on it, you must adjust the system library path according to your needs.

To run deployed MATLAB code against MATLAB Runtime rather than MATLAB, ensure that your library path lists the MATLAB Runtime directories before any MATLAB directories. For information on setting environment variables, see .

Alternatively, you can specify the location of MATLAB Runtime using the generated shell script for your compiled application.

Uninstall MATLAB Runtime

Windows

  1. Start the uninstaller.

    From the Windows Start menu, search for the Add or Remove Programs control panel, and double-click MATLAB Runtime in the list.

    You can also start the MATLAB Runtime uninstaller from the <MATLAB_RUNTIME_INSTALL_DIR>\bin\<arch> folder, where <MATLAB_RUNTIME_INSTALL_DIR> is your MATLAB Runtime installation folder and <arch> is an architecture-specific folder, such as win32 or win64.

  2. Select MATLAB Runtime from the list of products in the Uninstall Products dialog box and click Next.

  3. Click Finish.

Linux

  1. Close all instances of MATLAB and MATLAB Runtime.

  2. Enter this command at the Linux terminal:

    rm -rf <MATLAB_RUNTIME_INSTALL_DIR>

    Caution

    Be careful when using the rm command, as deleted files cannot be recovered.

macOS

  1. Close all instances of MATLAB and MATLAB Runtime.

  2. Navigate to your MATLAB Runtime installation folder. For example, the installation folder might be named MATLAB_Compiler_Runtime.app in your Applications folder.

  3. Drag your MATLAB Runtime installation folder to the trash, and then select Empty Trash from the Finder menu.

See Also

(MATLAB Compiler)

Related Topics