Starting from R2016a, you can distribute your standalone MATLAB Compiler application (or MATLAB Compiler SDK library) with an installer that includes only a subset of MATLAB Runtime that is needed for the application to run. With this installer, the selective, space-efficient MATLAB Runtime will be installed together with the standalone application.
There are three ways to create an installer for your compiled MATLAB application:
Option 1: Use Compiler Apps
Option 2: Use the 'compiler.package.installer' function
In R2020a, the 'compiler.package.installer' function was added as a programmatic way to create an installer. See the following pages for more information on syntax and usage:
Starting in R2025a, you can use the 'compiler.package.installer' function with the OptionalDependencies option to control whether the installer includes optional run-time dependencies. This option allows you to further minimize the size of the generated installer.
Option 3: Create a Docker container
Starting from R2020b, you can use 'compiler.package.docker' to encapsulate your compiled MATLAB application within a Docker® container. This method ensures the container will not contain the full MATLAB Runtime, but includes only the necessary products that your application relies on.
Note that this approach is currently supported only on Linux systems with Docker installed. This process also requires an internet connection, as MATLAB will have to download a copy of the Runtime installer and pull an Ubuntu Docker image during this process. See this documentation page:
The 'compiler.runtime.createDockerImage' function also supports the OptionalDependencies option to control whether the installer includes optional run-time dependencies in R2025a. This option allows you to further minimize the size of the generated installer.
Alternative: Create custom MATLAB Runtime installer (R2024b+)
For creating a custom MATLAB Runtime installer that does not package an application, see the following MATLAB Answer: