MATLAB Answers

License Manager Error -9 when run as administrator but not normally

196 views (last 30 days)
I have Ubuntu 16.04 and have a student version of Matlab and want to install a trial version of the Statistics and Machine Learning Toolbox. But the installer doesn't have permission (Access Denied: Unable to write to /usr/local/MATLAB/R2016b. Please select a different folder).
So I try to run Matlab with root permission using
sudo matlab &
but I get
License checkout failed.
License Manager Error -9
Your username does not match the username in the license file.
To run MATLAB on this computer, you must run the Activation client to reactivate your license.
Troubleshoot this issue by visiting:
Diagnostic Information:
Feature: MATLAB
License path: /home/pjhellemn/.matlab/R2016b_licenses:/usr/local/MATLAB/R2016b/licenses/license.dat:/usr/local/MAT
Licensing error: -9,57.
How do I allow Matlab to be run with root permissions, so that I can install the toolbox?


SeyedSaeid Hosseinipoor
SeyedSaeid Hosseinipoor on 12 Sep 2017
I have installed student version. It asked me about login name. I added my name and I faced this problem. I reinstalled it with login name and it was gone. Because just one login name was valid for me. Be careful about it.
Walter Roberson
Walter Roberson on 12 Sep 2017
If you are using OS-X or Linux, the username you tell MATLAB should be the same as what you get for the result of
when you run that at your shell prompt.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 27 Sep 2016
Correct. When you sudo, your username becomes root, which is not what is in the license file.
To install toolboxes on Linux you should run the installer, which you would do while sudo'd
(OS-X has the same issue about sudo and username, but when you use the Add-on explorer or the installer on OS-X, the process will ask you to authenticate and then will proceed to allow you to install.)


Paul Hellemn
Paul Hellemn on 27 Sep 2016
To add to this:
I had to first sign up for the trial version through the Mathworks website (the prompt in the Matlab application did not work), then download the Matlab installer again, and then follow the directions above.
Miguel Perez Sanchis
Miguel Perez Sanchis on 15 Nov 2017
This answer might be useful to those of us who ran into this problem and managed to solve it by installing Matlab with our username instead of root. All toolboxes installed afterwards should be installed through the Matlab installer as Walter said. The installer CAN be run as sudo, unlike Matlab

Sign in to comment.

More Answers (1)

Ryan Patterson
Ryan Patterson on 15 Dec 2019
Edited: Ryan Patterson on 15 Dec 2019
I figured it out.
In terminal go to where your activation file is located(This Might Be Different For You!) and run it. Not sure if you need "sudo" for this step.
$ cd /usr/local/MATLAB/R2019b/bin
$ sudo ./
When asked for a name, input "root" and complete the other boxes like normal. Exit matlab. Using "sudo -i" puts it in root mode so you have permission to install it.
$ sudo -i
# cd /usr/local/MATLAB/R2019b/bin
# ./matlab
Now you should be able to install the update. After its installed you should change the activation name back to what it was originally or else you will always have to run it under "root".
# exit
$ sudo ./


Show 2 older comments
Julián Eduardo Villamizar Peña
Thank you very much! This really solved my issues with the interface. The trick was about to change the username as root. Once you do that, it's just to execute matlab as root always.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by