Why do I get an error when trying to run my MATLAB R2012b deployed application from the Mac Finder window?

10 views (last 30 days)
I compiled a standalone application from my MATLAB code using MATLAB Compiler R2012b, on my Mac OS X. When I try to run my standalone application by double clicking on the application from the Finder window, I get this error message:
 
Dyld Error Message:
Library not loaded: @rpath/libmwcpp11compat.dylib
Referenced from: /Users/USER/Desktop/*/TestApp1.app/Contents/MacOS/prelaunch
Reason: image not found
I have the right version of MCR (v80) installed correctly in the default location. The standalone application runs fine when I run the accompanying .sh file from the terminal window, or if I call the standalone application from the MATLAB command window.
How can I make it run without errors when double clicking the .app file in the Finder window?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Nov 2016
This is due to a bug in the R2012b Compiler code and may affect shared libraries as well as standalone applications. Apply the patch below to your MATLAB R2012b installation and then recompile your standalone application to fix the issue. The patch should fix all subsequent compiled applications or libraries.
* Notes *
1. This patch is only for MATLAB Compiler R2012b. Do not apply this patch to other versions of MATLAB.
2. Administrator privileges are necessary to apply the patch.
* To apply the patch *
1. Download the appropriate patch below, attached to this Solution:
R2012b_LauncherFix.patch
These instructions assume you download it to the default location Safari uses, namely the “Downloads” folder of your home folder.
2. Start MATLAB, if it is not already running.
3. Unpack the patch into the correct folder. In the MATLAB Command Window, type:
 
>> cd(matlabroot)
>> !unzip -o ~/Downloads/R2012b_LauncherFix.patch
This should put the applauncher and prelaunch files into the <matlabroot>/bin/maci64 folder, where <matlabroot> is the installation location of your MATLAB.
4. Add proper permissions to the applauncher and prelaunch files. In the MATLAB Command Window, type:
 
>> cd([matlabroot '/bin/maci64'])
>> !chmod 775 applauncher
>> !chmod 775 prelaunch
The above code will require administrator privileges. If the CHMOD commands fail, please try the below:
 
>> cd([matlabroot '/bin/maci64'])
>> !sudo chmod 775 applauncher
>> !sudo chmod 775 prelaunch
The above should prompt administrator password before continuing with CHMOD. The CHMOD command changes the permissions on the patched files so that new deployed components won't run into unexpected permissions issues.
5. Recompile your application or library.

More Answers (1)

ccMango
ccMango on 10 Apr 2018
I got the same problem with my Matlab R2016a, is there any patch for this version?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!