This error is related to some of the environment variables from your user account not being passed to root when running the installer. There are 2 specific variables that will cause this, your DISPLAY variable, which will tell the install what screen to start on and XAUTHORITY which gives user permissions to display programs to that screen.
If you are unable to set these variables, please either speak to your IT department for assistance, or install MATLAB to a folder for which you have permissions.
This issue comes in two forms:
- With no error message
- With error messages
With no error message
If no error message appears when running the MathWorks installer as root, particularly with MATLAB R2021b, it may be an issue with an inability to access the X Server. As a workaround, please try the following:
- Launch Terminal
- Type the following in the terminal to allow the root user to access the running X server:
- After running the command above try running the installer "sudo ./install"
With error messages
On some distributions, other users are prevented from starting windows on X servers owned by other users. The XAUTHORITY environment variable points to the location of a key on your system that is required to start X applications on that display. Depending on your distribution, this key will be located in different locations. An error relating to XAUTHORITY may appear like the following or with no error message at all: