MATLAB: How to change the directory the support packages get installed in

How do I change the directory my support packages get installed in?

Best Answer

When installing support packages, the root directory is set to a default location for your specific system.
  • For Windows, the default root directory is :
R2016a or Older
'C:\MATLAB\SupportPackage\<release>'
R2016b or Newer
'C:\ProgramData\MATLAB\SupportPackages\<release>'
where <release> is your specific MATLAB release.
If the default directory already exists and is not empty, the root directory becomes 'C:\MATLAB\SupportPackages\<release>_1'.
  • For Unix, the default root directory is:
'/home/user/Documents/MATLAB/SupportPackages/<release>'
where <release> is your specific MATLAB release.
If the computed default directory already exists and is not empty, it becomes '/home/user/Documents/MATLAB/SupportPackages\<release>_1'.
You can change the location if your application requires a custom directory for installation. You must have administration privileges and be able to write to this custom folder. In order to set the support package root and verify the change, follow this example:
Note:   You must have administration privileges for the custom folder you specify.
matlabshared.supportpkg.setSupportPackageRoot('C:\MATLAB\CustomSupportPackageRoot')
matlabshared.supportpkg.getSupportPackageRoot()
ans =
C:\MATLAB\CustomSupportPackageRoot
When setting the support package root, savepath is called to add the location to the MATLAB search path. To ensure the path is loaded correctly, start MATLAB, run the setSupportPackageRoot function, and then restart MATLAB.