Why will MATLAB not start up properly on my Linux or UNIX based system?

452 views (last 30 days)
MATLAB will not start up on my Linux or UNIX based system, and I am not getting license manager errors.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 1 Apr 2020
Edited: MathWorks Support Team on 29 Oct 2020
If you are having trouble starting MATLAB on a UNIX-based system and you are not receiving license manager related errors, your start up problems may be resolved by performing the following steps:
Solution #1: Remove Preferences
Remove your preferences directory, so that it can be recreated cleanly:
1. Open the Terminal Application (usually found in Applications or Utilities).
2. In the terminal window and run the following commands:
cd ~/.matlab
3. Once in the .matlab folder, delete the folder for the version of MATLAB you have. For example, if you have R2015a, run the command:
rm -rf R2015a
NOTE: Do not remove any folder that ends with "_licenses."
4. Once cleared, restart MATLAB. The preferences should be recreated.
On some distributions, launching MATLAB with sudo will create MATLAB preferences in your home folder that are owned by root. You will then not able to launch MATLAB as a standard user as MATLAB will not be able to read it's own preferences. 
Solution #2: Move Working Directory 
If the above solutions do not work, be sure that there are no files conflicting on your MATLAB path. To verify that your work files and/or startup.m files are not conflicting with this MATLAB installation, perform the following steps:
1. Move the contents of your ~/Documents/MATLAB folder to another location on your computer.
2. Start MATLAB again to see if the problem still occurs.
If this resolves the problem, one of your work files is likely conflicting with your MATLAB installation or your startup.m file is crashing MATLAB.
Solution #3: Disable SELinux, AppArmor or other security software:
Try running MATLAB with SELinux disabled. SELinux may prevent MATLAB from starting. To temporarily disable it, run the following command as root:
/usr/sbin/setenforce 0
(/usr/sbin/setenforce 1 will turn SELinux back on)
To disable AppArmor on newer Ubuntu versions, run the below as root:
invoke-rc.d apparmor kill
update-rc.d -f apparmor remove
Once disabled, try MATLAB again. If it works, see the Related Solution at the bottom of the page:
"Why do I receive errors relating to the file "libmwlapack" when starting MATLAB R14SP3 or higher on Linux?"
Note: You may also have to reset the permissions on the folder you are trying to install from. Run the following command to modify the permissions:\n
chmod -R 755 $installfolder
Solution #4: Debugging Mode
Open MATLAB with the Desktop and Java options Disabled:
1. From the terminal, type the following:\n
Where $MATLABROOT is the path to your root MATLAB directory)
By default this will be /usr/local/MATLAB/R2015a/bin for R2015a. 
2. Try launching MATLAB with each of the below commands:
matlab -nodesktop
matlab -nojvm
matlab -nodisplay
If MATLAB starts in either of these modes, there is most likely a Java issue. If MATLAB fails to start in either of these modes, more information may be obtained from the MATLAB crash dump files. These files will be located in your home folder and will have the names:
If any of these files exists, send those files along with the output of the commands above to the Installation and Licensing team using the form at the bottom of this article.
Solution #5: Missing Libraries
MATLAB is tested and fully qualified on Ubuntu, Debian, Red Hat Enterprise Linux (RHEL), and SuSE. However, it will still run on most popular distributions of Linux, provided it is a full desktop installation of the distribution. MATLAB is not supported on minimal or server distributions. A minimal installation may not contain all libraries that MATLAB requires. 
Even if you intend to run MATLAB only in non-graphical mode, MATLAB requires some X11 libraries to run. However, we are not able to specify the X11 requirements down to the exact set of packages required because different distributions may package the libraries differently. MATLAB will work out of the box on desktop installations of any supported distribution. 
See the below for a list of qualified distributions:
If you are still unable to launch MATLAB on Linux after trying these troubleshooting steps, please contact the Installation & Licensing Support team:
Mengchu Xu
Mengchu Xu on 23 Nov 2018
I also met the problem and your solution is quite useful for me! Thank you!

Sign in to comment.

More Answers (3)

KBundy on 21 Jan 2016
Edited: KBundy on 4 Apr 2016
I had this problem also, and found that the answer provided did not solve it. The issue was that the .matlab folder in the Home directory was owned by root after this install. I was able to fix the issue with
sudo chown [yourusername]:[yourusername] ~/.matlab
cd ~/.matlab
sudo chown -R [yourusername]:[yourusername] *
This sets the ~/.matlab folder and all of its contents to be owned by the main user not root. This is especially important if you have tried to launch MATLAB with sudo or straight from the install.
I found that changing only the ~/.matlab folder to be mine would allow the software to launch with -nojvm but the other start options showed errors. I originally thought this was a java issue, but actually it was hitting java IO exceptions from the bad folder permissions.

Charles Swenson
Charles Swenson on 11 Sep 2019
MATLAB will no longer start for me. I am running macOS Mojave 10.14.6. MATLAB used to work just fine for years but then today I was trying to open a .m file located in a directory on Google file stream mount and MATLAB locked up. After waiting a long time I forced MATLAB to quit. I have not been able to get MATLAB to start after this event. No splash screen at all. I would get a OS message window saying MATLAB was not responding (on start up). I rebooted my computer and now MATLAB will show the splash screen which then dissapears without MATLAB starting. I am trying solution #4 above in a Terminal window and getting the following errors:
spacemac:bin chucks$
spacemac:bin chucks$ pwd
spacemac:bin chucks$ ./matlab -nodesktop
< M A T L A B (R) >
Copyright 1984-2019 The MathWorks, Inc.
R2019a ( 64-bit (maci64)
March 8, 2019
PostVMInit failed to initialize com.mathworks.mwswing.MJStartupForDesktop
To get started, type doc.
For product information, visit www.mathworks.com.
>> quit
Exception in thread "AWT-EventQueue-0": java.lang.NullPointerException
at java.awt.Window.init(Window.java:497)
at java.awt.Window.<init>(Window.java:436)
at java.awt.Window.<init>(Window.java:561)
at com.mathworks.jmi.util.ShutdownHelpers$1.run(ShutdownHelpers.java:125)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
spacemac:bin chucks$
spacemac:bin chucks$ ./matlab -nojvm
< M A T L A B (R) >
Copyright 1984-2019 The MathWorks, Inc.
R2019a ( 64-bit (maci64)
March 8, 2019
For online documentation, see https://www.mathworks.com/support
For product information, visit www.mathworks.com.
>> quit
spacemac:bin chucks$ ./matlab -nodisplay
< M A T L A B (R) >
Copyright 1984-2019 The MathWorks, Inc.
R2019a ( 64-bit (maci64)
March 8, 2019
To get started, type doc.
For product information, visit www.mathworks.com.
>> quit
spacemac:bin chucks$

John Davis
John Davis on 11 Jan 2022
Hello Folks,
I have a weird problem. I can run matlab in the terminal. I can not run it in Gnome using the launcher.
ls -ald ~/.matlab shows that the dir is davis:davis for ownership.
I have done rm rf ~/.matlab/R2021b
Attempted again using launcher.
I am on Debian (the biggest is still the best) and this is my ~/.local/share/applications/matlab.desktop file contents
#!/usr/bin/env xdg-open
[Desktop Entry]
GenericName=matlab app


No tags entered yet.


Community Treasure Hunt

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

Start Hunting!