MATLAB Tutorials

From Macro Wiki
Revision as of 20:03, 6 July 2020 by Frederico.afonso (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is a simple tutorial to teach how to install MATLAB and properly activate it using the academic license from UFMG. It is based on the official tutorial from MathWorks, but it contains additional details regarding the installation on Linux which I have noticed to be missing on the original tutorial. Additionally, the information about the superuser seems to also be relevant for macOS users (needs confirmation). Nonetheless, the official tutorial, and the discussion topics that inspired this tutorial, are linked at the end of this page.

How to obtain the license

  1. Create a MathWorks account here using your institutional email (you will not get access to the license if you use your personal email);
  2. Link your account with the academic license of UFMG accessing here, selecting "Sign in to get started" and then using your MathWorks account previously created;

Download and installation

  1. On the page of the last step, select "Download installer", then choose the version you want to download and your operating system (which, in this tutorial, is assumed to be Linux);
  2. Extract the zip file, go to the extraction folder and run the installer
    sudo ./install
  3. Sign in with your MathWorks account and accept the "user agreement";
  4. Select the academic license from UFMG, that you just linked with your account on the last step of "How to obtain the license", and click "next";
  5. Select your Login Name. Here you have two options:
    1. Use your computer's user name. On the Terminal, run whoami and past the result on the installer. If you choose this option, you WILL NOT be able to initiate MATLAB as a superuser. On Linux (and possibly on macOS), this means you should not install MATLAB on the default path, as you will not have access to any of those folders (e.g., /usr/local/MATLAB/R2020a/) and any attempt of running MATLAB will result in several errors. I never tried to install MATLAB in an alternative folder and, therefore, do not know if this creates further problems (e.g., with software updates or toolboxes installation).
    2. Use the superuser as login name by typing "root". This will allow you to initiate MATLAB as a superuser and to use the default installation folders. (This is the option I have chosen and recommend.)
  6. Select the installation folder considering the previous discussion and click "next";
  7. Select the products you want to install and click "next". Selecting all the toolboxes will result in a considerable installation time;
  8. Select the desired options of software improvement and folder for symbolic links (again, remember the necessary permissions to access this folder) and click "next";
  9. Select "begin install".

MATLAB initialization

  1. Go to the installation folder (here I am assuming the default)
    cd /usr/local/MATLAB/R2020a/bin
  2. Initiate MATLAB
    sudo ./matlab

To simplify this process, it is recommended to create an alias for the MATLAB. For instance, following this tutorial.


Licensing error: -9

This problem is caused by either a wrong Login Name (e.g, you are trying to run MATLAB as superuser, but registred it to your computer's name) or a wrong HOST ID name (there was some problem with your license registration). To solve this, we are going to deactivate your current license, reactivate it and (probably) perform an offline registration of MATLAB.

  1. Go to your MathWorks account here;
  2. Select your license number;
  3. Go to
    Install and Activate -> Activate to Retrieve License File
  4. Select your activated computer and then "Deactivate";
  5. Repeat the previous steps, but on the last one now select "Activate a computer";
    Select your release version;
    Select your operating system;
    Select your HOST ID. This should be your MAC address (if the interfaces are enumerated, use the lowest-enumerated interface). To get this address on Linux, open the Terminal and run
    ip addr | grep ether
    Select your Login Name. This should be the same you are using on your computer (i.e., computer's user name or superuser ID);
    Select an Activation Label. Any name is valid, this is purely to help you identify the computer you are registering;
    Click on "Continue".
    Download your license file by either clicking on the blue arrow or selecting your computer by name and clicking on "Get license file". Answer that you have already installed MATLAB on this computer and select "Download license file".
  6. Open a Terminal and run
    sudo /usr/local/MATLAB/R2020a/bin/
  7. Select "Activate automatically using the internet" and follow the instructions;
    Try to run MATLAB;
    If the error persists, follow the next steps.
  8. Select "Activate manually without the Internet -> Enter the full path to your license file", then select the license you downloaded from your MathWorks account;
  9. Go to MATLAB's license folder (/usr/local/MATLAB/R2020a/licenses) and delete any other license files that are there besides the one you just added (the name of the one you downloaded is probably "license.lic");
  10. Run MATLAB.


  1. Official tutorial from MathWorks
  2. License Manager Error 9
  3. Activate MATLAB without internet connection
  4. Find your HOST ID
  5. Find your computer Login Name