How to fix Matlab “Failure loading desktop class” error in Linux

15 Apr 2018

Trying to run Matlab in your Linux machine? (brave soul, you). Well, the last update probably broke something and you’re out and about in the web trying to fix that issue with a ever so vague error message.

Does that error look like this?

matlab Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.

Yeah, that’s what I thought.

Here’s your fix:

  1. Find the Matlab installation directory in your system. (mine was /usr/local/MATLAB/R2017a/ )
  2. cd into the glnxa64 folder of your installation directory
     $ cd /usr/local/MATLAB/R2017a/glnxa64
    
  3. Delete libfreetype.so.6 and libfreetype.so.6.13.0 files inside this directory.
     # rm libfreetype.so.6
     # rm libfreetype.so.6.13.0
    
  4. Create a symlink from your libfreetype.so.* files from /usr/lib64/ directory to the deleted file path, like so:
     # ln -s /usr/lib64/libfreetype.so.6 /usr/local/MATLAB/R2017a/bin/glnxa64/libfreetype.so.6 
     # ln -s /usr/lib64/libfreetype.so.6.13.0 /usr/local/MATLAB/R2017a/bin/glnxa64/libfreetype.so.6.13.0
    
  5. (optional) Restart your computer.

Hope that fixed your problem! But, who’re we kidding, this probably broke something else…. aaand away you go.