- (Recommended) Rename <matlabroot>/sys/java/jre/maci64/jre to <matlabroot>/sys/java/jre/maci64/jre_bak.
- Copy the content of <jre_root>/Contents/Home to <matlabroot>/sys/java/jre/maci64/.
- Confirm the operation by finding “java” executable in the path <matlabroot>/sys/java/jre/maci64/jre/bin/java.
- Launch MATLAB and verify the JRE version with “version -java”. The output should include “AdoptOpenJDK”.
Why do buttons, apps, or the editor in MATLAB respond slowly or hang on MacOS?
237 views (last 30 days)
Show older comments
MathWorks Support Team
on 4 Oct 2018
Commented: Yi Ge
on 19 Dec 2022
I am using MATLAB R2019a and MATLAB R2018b with MacOS High Sierra, and I am seeing performance issues with many UI interactions such as the following:
- Really slow responses (4-5 seconds) when pressing buttons such as 'Run' and 'New'
- Lag when re-positioning the text cursor in a script file via mouse click (or highlighting sections of text)
- Lag or a freeze when interacting with some apps such as the Color Thresholder or Image Viewer apps
I did not face these issues with MATLAB R2018a
How do I solve this issue?
Accepted Answer
MathWorks Support Team
on 30 Nov 2022
Edited: MathWorks Support Team
on 30 Nov 2022
This issue can be caused by the incompatibility of Magnet App, BetterTouchTool, or similar window-snapping apps with MATLAB on macOS. It has been observed with R2019a, R2019b and R2020a Prerelease on High Sierra and Catalina macOS. For Magnet, asking the program to ignore MATLAB may resolve the issue.
This can also be due to applications like Text Expander and Phase Express.
To work around the issue, please try one of the following solutions to see if it resolves the issue:
1) Switch MATLAB to use OpenJDK™ 8 (Hot Spot) version of JRE that can be downloaded from the following link:
To switch the JRE that MATLAB is using:
2) Switch MATLAB to use the JetBrains version of JRE that can be downloaded from the following link:
Installing the version of JRE linked above may cause JAVA errors in MATLAB. However, these errors should not have any side effects.
3) If you are using a multi-monitor setup, moving MATLAB to a secondary monitor may prevent the issue. However, moving MATLAB back to the primary monitor may cause the issue to recur.
4) Consider switching to Spectacle. Performance regressions have not been reported on this App thus far. Find more information on the Spectacle App in the link below:
5) You should be able to use keyboard shortcuts with no delays.
6) Closing the window-snapping app and restarting MATLAB may solve this issue. This has been seen to be effective for many past instances of similar behavior.
Alternately, you might also be able to work around this incompatibility by disabling some functionality in the window-snapping app you are using or changing its settings to ignore MATLAB.
For instance, we have seen that BetterTouchTool can be left running, but the "Window Snapping" feature must be disabled for MATLAB to function properly. If quitting the app resolved the issue, you may want to try to disable the "Window Snapping" feature and restart MATLAB, if it is more convenient for your workflow.
24 Comments
More Answers (6)
Steve Myers
on 11 Oct 2020
Edited: Steve Myers
on 11 Oct 2020
All I did was tell Magnet to "Ignore MATLAB" and it resolved the issue for me.
EDIT: Still laggy when you switch windows to another app then come back to MATLAB like that, quitting Magnet will fix that if it's bothersome.
2 Comments
Seb Biass
on 6 Dec 2018
Edited: Seb Biass
on 6 Dec 2018
Same problem here, latest 2018 MBP, OSX 10.14, Matlab 2018b. Pretty much any interaction with GUIs - either the Matlab interface or custom GUI crashes Matlab. No window management software installed. It worked fine on OSX 10.13.
Please fix?
Update: As a matter of fact it does not crash, it is just extremely slow. On a custom built GUI it takes about a minute to change from one field to another.
Update #2: I run 2018a on my iMac with 10.14 with both BetterTouch and Magnet installed and there is no problem whatsoever. It seems that this is more likely a Matlab problem than a Magnet....
1 Comment
Shweta Singh
on 5 May 2020
Edited: MathWorks Support Team
on 14 Jun 2022
Hi Seb,
If you are still facing the issue, please reach out to MathWorks Technical Support by using the following link and they will be able to assist you further:
Thanks,
Shweta Singh
Elizabeth Kauffman
on 23 Aug 2021
Edited: Elizabeth Kauffman
on 23 Aug 2021
Open it using the Terminal app and type in open -a MATLAB_R20***
It immediately made it a lot faster.
0 Comments
Mingyu Son
on 26 Jan 2022
Had an issue of whole program stopping when trying to use zooming features of scope in simulink with R2021b, using on M1 macbook air, but just by simply quitting rectangle (any window adjusting program) and restarting the matlab fixed the issue for me.
3 Comments
Walter Roberson
on 10 Dec 2022
As best I can tell, Apple made a change to the Accessibility interface in a way that can lead to an indefinite cycle of notifications if more than one program is using the interface for the same window, each program getting notified about the actions of the other programs. One program gets notified that the second program accessed the interface, the first program asks what the current situation is, the second program gets notified that the first used the interface, it asks, "Oh, what's the state now?", the first program gets notified that the second program is dealing with the state... infinite loop.
Fundamentally it was Apple's responsibility to create an interface in a way that prevented event storms and indefinite go-arounds (P changes the elements, Q changes them back, P changes them again... etc..)
Apple's response in the case of Apple-created problems about inner workings that Apple did not explicitly document, is almost always "Oh, we never promised that, it's your fault for relying on behaviour that worked for the last 15 years." Apple "rules-lawyers" their way out of responsibility. Or they just "I am altering the deal. Pray I do not alter it any further."
Yelin Shan
on 22 Dec 2019
I know this problem, that's because I open a window-snapping apps which is a translation software. So just be sure that you don't open any window-snapping app.
0 Comments
Peter Drummond
on 2 Jun 2020
I have a brand new iMac Pro, running a completely standard Catalina MacOS, and Matlab 2020 editing is often painfully slow. Relative to any previous Mac, it is very much slower, despite the much better hardware. It used to be said that Intel giveth and Microsoft taketh away. Now it seems that Apple giveth and The MathWorks taketh away. Currently, I'm mostly forced to edit on my freeware editor, due to extraordinarily slow Matlab editor.
Funny thing: Matlab is very expensive and freeware is, well, free.
6 Comments
Walter Roberson
on 10 Dec 2022
Because other apps DO have these issues. Apple mucked up an event notification protocol, leading to infinite notifications
See Also
Categories
Find more on Loops and Conditional Statements 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!