Skip to content

chriswifn/Install-Matlab-on-Arch-Linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Install matlab on Arch Linux

./img/matlab.jpg

Table of Contents

Disclaimer

  • This is the installation process that worked for me. For a more detailed installation and and troubleshooting see the Arch Linux Wiki.
  • The individual steps are at the beginning of every paragraph.
  • Matlab has to be one of the biggest pieces of shit in terms of applications. Please port your scripts to GNU Octave if you are not forced to use Matlab.
  • I assume that you know your way around your file system and now how to launch an application without clicking an icon.
  • This guide was written in rage that the atrocity of installing Matlab caused me so excuse the typos.

Installation

This installation is written for Matlab R2022b.

Download the zip archive

Download the zip archive from to official website of Matlab. You are going to need an account which includes having a license. The following instructions assume that you downloaded the .zip into your Downloads folder.

Create two new folders

cd ~/Downloads/
mkdir matlab
mkdir TMP

Prepare for extraction

mv matlab_R2022b_glnxa64.zip matlab/
cd matlab/

The reason I do this is so I don’t unzip matlab into my Downloads folder which would be a huge mess.

Unzip the archive

unzip matlab_R2022b_glnxa64.zip

Nothing out of the ordinary here.

Remove incompatible library

rm ./bin/glnxa64/libfreetype.so*

One of the libraries that the installer uses is incompatible with the freetype2 library in Arch Linux. So you need to remove these files.

Start the installer

sudo ./install -downloadFolder /home/<user>/Downloads/TMP/

For some reason I could only get this to run successfully with the -downloadFolder flag. I have no idea why but this seams to fix the issue. You need to run the install script with elevated privileges so that the installer can create the directory /usr/local/MATLAB/ und create symlinks to /usr/local/bin. I would recommend not changing anything because the installer has a mind of its own and anything I change let to failure.

Run through the installer

IMPORTANT!: Tick the option to create symlinks to your $PATH. For some reason this is not ticked on by default. If you wish to launch the matlab application without typing the full path or creating symlinks manually this is recommended. ALSO IMPORTANT!: Your login/user name should be the same as your whoami information. During the installer your only option is to pray to god that it doesn’t freeze or crash another way because there is nothing you can do.

This should successfully download all the files and install Matlab if you are lucky.

Activate Matlab

cd /usr/local/MATLAB/R2022b/bin/
sudo ./activate_matlab.sh

Although you already entered your credentials twice by downloading the zip archive and during the installer you still need to prove that you have a license one more time. For what ever reason the developers of this piece of trash have decided that they were not able to do that during the installer just to make your life a little bit harder. Assuming you have installed to the standard path and you have ticked the option to create symlinks to your $PATH the activate_matlab.sh script should launch just fine if you run it with elevated privileges. Enter your credentials. Hopefully you remember the user name from the install wizard. Otherwise you are in trouble.

Unable to open or create live scripts

cd /usr/local/MATLAB/R2022b/bin/glnxa64/
sudo rm libfreetype.so*

The same library incompatibility that the installer had still exists. You are propably not gonna be able to open or create new live scripts. To fix this issue remove the according files in the installation path. This is only a problem if you intend to use the shitty IDE that Matlab comes with. That’s fine if you want to walk your dog for two ours to skip the input delay. If you intend to use a real text editor follow the following step.

Configure Matlab in GNU Emacs

Use matlab-mode

Open your Emacs configuration file and add the code block:

(autoload 'matlab-mode "matlab" "Matlab Editing Mode" t)
(add-to-list
 'auto-mode-alist
 '("\\.m$" . matlab-mode))
(setq matlab-indent-function t)
(setq matlab-shell-command "matlab")

Set a key binding to launch the matlab-shell

If you want to use the matlab-shell to run your Matlab scripts add the following:

(defun open-matlab-shell ()
  (interactive)
  (split-window-below 30)
  (other-window 1)
  (matlab-shell))
(my-leader-def
  :states 'normal
  :keymaps 'override
  "c m" '(open-matlab-shell :whichkey "Open Matlab shell"))

This only works if you use the general package for better keybinding declaration and the whichkey package.

Conclusion

Congratulations. Now you don’t have to wait a couple of seconds to do anything in the trashy IDE of Matlab. However you are still going to have to wait a couple of seconds to launch the matlab-shell. Deal with it or use a real programming language that starts indexing at 0.

Other errors

If you are not annoyed yet there may be some more errors that you could potentially encounter.

Standalone window managers

If you use a standalone window manager JAVA is your biggest enemy. JAVA applications don’t behave well inside standalone window managers if the WMName is not set to “LG3D”. Install the program wmname. It is propably in your distributions repositories. Otherwise compile it from source that should be pretty easy because it is a minimal application. Otherwise you propably can’t even launch matlab due to this bug.

Matlab doesn’t launch with the matlab command

You would assume that the command matlab would launch the IDE. NO IT DOES NOT. It just launches the splash screen. WHO THE HELL THOUGHT OF THIS SHIT. You have to use the command matlab -desktop because it is not obvious enough that I want to launch the desktop version when I am in an X11 environment.

Conclusion

Congratulations. You may or may not be able to use Matlab after following this guide. To avoid this headache use something else. GNU Octave is a good trop in replacement if you are willing to change your scripts a little bit because it doesn’t come with all the prebuild functions that Matlab has.

About

Install Matlab on Arch Linux

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published