Library not loaded: @rpath/libcudart.10.2.dylib
Show older comments
I've recently been getting the following error when trying to run "bwlabel.m". Trying to run code that had been working as recently as a month ago. Any advice would be appreciated.
Running Matlab 2020b on Mac OS 10.15.7.
%%
Unable to load bundle binary
/Applications/MATLAB_R2020b.app/bin/maci64/builtins/images_builtins/mwlibmwimagescore_builtinimpl.dylib. Error:
dlopen(/Applications/MATLAB_R2020b.app/bin/maci64/builtins/images_builtins/mwlibmwimagescore_builtinimpl.dylib, 10):
Library not loaded: @rpath/libcudart.10.2.dylib
Referenced from: /Applications/MATLAB_R2020b.app/bin/maci64/libopencv_core.4.2.0.dylib
Reason: no suitable image found. Did find:
/Applications/MATLAB_R2020b.app/bin/maci64/libcudart.10.2.dylib: code signature invalid for
'/Applications/MATLAB_R2020b.app/bin/maci64/libcudart.10.2.dylib'
11 Comments
Image Analyst
on 6 Jun 2022
I'd call tech support on that one. If you can't or won't, then I'd try to reinstall MATLAB. Or you can try
restoredefaultpath
sometimes that fixes weird problems.
Walter Roberson
on 6 Jun 2022
https://stackoverflow.com/questions/41865537/how-does-apples-codesign-utility-decide-which-sha-algorithms-to-sign-a-shared maybe??
Luke Mason
on 7 Jun 2022
I'm also having this problem, also 10.15.7. I'll edit this post if I find a solution.
Chenyi Fei
on 7 Jun 2022
I got the same problem. I'm running Matlab 2020a on Mac OS 10.15.6
Cata_Ray
on 7 Jun 2022
Same problem in Mojave with 2020a. 2018 working correctly.
Daniel Dahan
on 8 Jun 2022
same problem in Monterey 12.4 and Matlab 2019b
Michael Gardner
on 8 Jun 2022
Same problem Catalina 10.15.6, MATLAB R2020a
Pierre Lanari
on 8 Jun 2022
Edited: Pierre Lanari
on 8 Jun 2022
Same problem with Catalina 10.15.7 and MATLAB R2020b or R2020a. I contacted the tech support and they don't have a solution yet.
Clio Gonzalez Zacarias
on 8 Jun 2022
Hi evereryone, I am having the same issue and I had spent around 4 days already tryin to find a way around this. From a collegue I got that maybe the reason is the most recent Apple security updates are listed here
These updates are probably what did it. Gatekeeper is what is making the decision that the library is not safe.
The affected operating systems are Catalina, BigSur. Monterrey as of May 16 2022.
I tried to use some of the old suggestions from:
and declaring the DYLD_LIBRARY_PATH as suggested here:
Also, I tried some of the don'ts for Mac
So far no success.
If anyone finds a way around this I am really interested on learning how to Fix it.
Thanks everyone.
Graham Fraser
on 8 Jun 2022
Edited: Graham Fraser
on 8 Jun 2022
I was able to work around this problem on Mojave (10.14.4) by copying:
/Applications/MATLAB_R2020a.app/bin/maci64/libcudart.10.1.dylib
to:
/usr/lib
Delete and reinstall MATLAB, Reboot, and bwlabel should work again.
This workaround doesn't seem to work on Catalina and above because root cannot modify /usr/lib. Disabling SIP protection may get around this but so far I haven't been able to get my solution to work even with SIP disabled.
Hope this helps get us closer to a permanent solution.
雨鑫 史
on 5 Jul 2022
I have the same problemi
Accepted Answer
More Answers (5)
For other mac users who don't want to update MATLAB and don't have access to /usr/lib: I found that copying the library to /usr/local/lib did the trick, provided I also added an 'ad-hoc' code signature, eg:
sudo cp /Applications/MATLAB_R2020b.app/bin/maci64/libcudart.10.2.dylib /usr/local/lib
sudo codesign --deep -fs - /usr/local/lib/libcudart.10.2.dylib
Tested on:
- R2020b on Big Sur (11.6.6)
- R2019b on Mojave (10.14.6) - note libcudart version is different: libcudart.10.1.dylib
Note that this solution is just based on previous answers (https://uk.mathworks.com/matlabcentral/answers/1735020-library-not-loaded-rpath-libcudart-10-2-dylib#answer_982300 + https://uk.mathworks.com/matlabcentral/answers/403742-invalid-mex-file-and-missing-libmwblas-dylib-error#comment_1506540 ) + google + trial and error. I have no expertise in macOS code signing and would welcome thoughts from Mathworks or others on whether this is a sensible thing to do.
---
Update 22nd June: As pointed out by @Tyler Cumby in the discussion below, there is no need to move the file to /usr/local/lib - you can just run the codesign command directly on the relevant file
14 Comments
guitalele
on 13 Jun 2022
Daniel Dahan
on 13 Jun 2022
It is working for me. Thanks!
Tyler Cumby
on 13 Jun 2022
Edited: Tyler Cumby
on 13 Jun 2022
This also an issue in the 2020b MATLAB Runtime as well. If you check the code-signature via a bash shell
codesign --verbose --verify /Applications/MATLAB/MATLAB_Runtime/v99/bin/maci64/libcudart.10.2.dylib
returns
/Applications/MATLAB/MATLAB_Runtime/v99/bin/maci64/libcudart.10.2.dylib: CSSMERR_TP_CERT_REVOKED
In architecture: x86_64
So the code-signature for the file is not valid, which is prohibited by the Gatekeeper on recent macOS versions (I'm on Mojave and it prohibits dynamic loading of this library).
It is sufficient to code-sign the file 'in place', i.e. you don't need to move the file to /usr/local/lib. If you leave it in place, the dynamic loading will follow the @rpath path expansion, as intended by Mathworks.
Thanks @Tyler Cumby, that clarifies things. I googled CSSMERR_TP_CERT_REVOKED and found some useful backround eg: https://eclecticlight.co/2020/10/28/code-signatures-1-how-they-work-and-stop-working/. In particular:
"At least on Macs running Mojave and later, notifications of certificate revocations are obtained by the background process com.apple.security.syspolicy.check.revocation which is normally set to run every three days. It also appears able to pick up changes more frequently, but isn’t something the user can control."
Initially I assumed a macOS update had tightened security (hence the sudden appearence of the issue), but looking at the update history on multiple affected machines I couldn't find a common recent secuirty update that could explain this.
It sounds like maybe it's more likely that the certicficate has been revoked and the issue appeared when apple pushed out the latest revocations.
Thomas Vande Casteele
on 14 Jun 2022
Tested with Matlab R2020b on Mojave 10.14.16 and did the trick !
Thank you for this one.
Tyler Cumby
on 14 Jun 2022
@guitalele Well done. I think you're probably right. Debugging issues in macOS are always more complicated because of how (intentionally?) opaque Gatekeeper is when you violate one of its requirements (and somehow I still forget this). Initiially when I was looking into this I was checking dyld debug output to see if there was an errant /imcompatible library getting loaded and was thrown off by rpath expansion failures. otool -L was not reporting any missing symbols and then wondered about code-signing issues (clearly the wrong order for debugging, in retrospect).
Tyler Cumby
on 14 Jun 2022
@guitalele On a whim, I tried to install the 10.2 Cuda RT on my Mojave macbook, but the code-signing cert for the installer has been revoked as well. So, I guess NVidia's cert was revoked in the recent past?
guitalele
on 15 Jun 2022
Good spot @Tyler Cumby - sounds like you're right. Apparently NVIDEA got hacked recently, eg: https://www.tonymacx86.com/threads/nvidia-driver-certificate-revoked.320596/post-2324115
Tyler Cumby
on 15 Jun 2022
@guitalele I've reported this to Mathworks Support.
José Alejandro Rojas López
on 16 Jun 2022
It worked on Mac Mojave 10.14.6 and Matlab R2019b
Thanks
Runnan Cao
on 21 Jun 2022
This solution works for macOS Catalina 10.15.7!!!
Thank you so much for sharing!
Pierre Lanari
on 22 Jun 2022
This solution works for me on macOS Catalina as well.
Thank you so much!
Jessica Zhao
on 28 Jun 2022
Works for me on macOS Monterey 12.4 for MATLAB R2020a too! Thank you!
Fatemeh Taheri
on 12 Jul 2022
It's work for me on macOS Big Sur 11.6. Thank you!
Bhavana Ravirala
on 9 Jun 2022
0 votes
Hi Nitin,
Go through the following link which helps in eliminating the error.
Hope this helps.
1 Comment
Pierre Lanari
on 9 Jun 2022
Thanks for the suggestion.
As I don't have access to /usr/lib/ on Catalina, I have tried moving the library to my working directory (and various other locations in the MATLAB path).
I can find the library with the command:
which libcudart.10.2.dylib
However, this does not eliminate the error for me.
Naveh Levanon
on 9 Jun 2022
0 votes
I had this problem now too in R2020b.
I installed R2021a fresh and the problem is gone. Others say re-installing R2021b works too. Possibly any re-install would fix this.
4 Comments
Daniel Dahan
on 9 Jun 2022
Edited: Daniel Dahan
on 9 Jun 2022
I have this problem in 2019b, and re-installing it did not solve the problem for me. However, 2022a works for me.
Based on the comments here I think the problem is up to 2020 versions.
Vanessa Stenvers
on 9 Jun 2022
I had the same problem (MacOs Catalina 10.15.7, R2020b) and installing R2021a worked to fix it, thank you for the tip!
Pierre Lanari
on 10 Jun 2022
A fresh installation of R2021a did not solve the problem for me.
Joss Knight
on 13 Jun 2022
Hi Pierre. MATLAB does not ship the offending library (libcudart) in R2021a so I'd be interested for you to elaborate more to help us work out what's going wrong for you. Perhaps you are running a MEX function?
Abbas Ezzat
on 11 Jun 2022
0 votes
How can i run polymeric composite formulations to optimize selction criteria
1 Comment
Walter Roberson
on 11 Jun 2022
I do not understand the relationship to the libcudart question?
Joss Knight
on 4 Jul 2022
0 votes
This problem should now be fixed at Apple, please reboot and report here if you are still experiencing issues.
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!