How to install Sublime Text 2 on Ubuntu 12.04 (Unity)

Sublime Text is an awesome text editor. If you’ve never heard of it, you should check it out right now.

I’ve made this tutorial because there’s no installer for the Linux versions of Sublime Text. While that’s not a real problem, I feel there is a cleaner way to go around this. Also, this post will show you how to integrate Sublime Text to Unity (which, I’m glad to report, has now matured into a fully functional user interface). So let’s get on with this. Here is my how to install Sublime Text on Ubuntu tutorial.

[This tutorial has been updated following feedback from AskUbuntu. Also, you need to do these steps using your login. Do not start by typing “sudo -s”!]

Step 1

Download the tarfile that suits you best and extract it. Here’s the command to extract tar.bz2 files:

tar xf Sublime\ Text\ 2.0.1\ x64.tar.bz2

You’ll notice that I got the 64-bit version. The reason is that it’s lightning fast. So, go for that if you can!

Step 2

You’ll get a “Sublime Text 2″ folder after extraction. This folder contains all the files that Sublime Text will need. So we have to move that folder somewhere more appropriate. Like the “/opt/” folder :

sudo mv Sublime\ Text\ 2 /opt/

Step 3

At some point you’d want to be able to call Sublime Text from the Terminal by just typing “sublime”. To do that, we’ll just create a symbolic link in “/usr/bin” like thus:

sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

Step 4

Now that our files are at the right place, we need to create a launcher in Unity. To do this, we’re going to create a .desktop file in “/usr/share/applications”:

sudo sublime /usr/share/applications/sublime.desktop

And paste the following content:

[Desktop Entry]
Name=Sublime Text 2
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor

Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png

[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n

As you can see, these lines are quite straightforward. Go ahead and experiment a bit with them.

Step 5

Now you would probably want to open all text files with Sublime Text 2. The easiest way to do that is to open up the file associations list:

sudo sublime /usr/share/applications/defaults.list

And replace all occurrences of gedit.desktop with sublime.desktop. Tada ! There you go. You now have Sublime Text 2 installed on Unity on Ubuntu 12.04, like a pro. Here are some screenshots:

328 Comments to “How to install Sublime Text 2 on Ubuntu 12.04 (Unity)”

  1. kevin says:

    When I double click sublime_text I get 3 files with “��L@X (invalid encoding)”, “�lS22c (invalid encoding)”, and “!���� (invalid encoding)” as the names and no contents. The editor doesn’t open. If I try to run it through the terminal I get:

    ./sublime_text: 1: ./sublime_text: ELF: not found
    ./sublime_text: 1: ./sublime_text: : not found
    ./sublime_text: 1: ./sublime_text: �@8: not found
    ./sublime_text: 2: ./sublime_text: p��
    �!: not found
    ./sublime_text: 3: ./sublime_text:��: not found
    ./sublime_text: 4: ./sublime_text: ���!�: not found
    ./sublime_text: 4: ./sublime_text: ���
    �: not found
    ./sublime_text: 5: ./sublime_text: Syntax error: word unexpected (expecting “)”)

    Any ideas?

    • kevin says:

      I think it’s because I’m running 32-bit Ubuntu and the Sublime Text package I got was 64-bit. I thought I was running 64-bit Ubuntu. =/

  2. Jevin says:

    That’s strange. Looks like the file is corrupted.
    Have you tried re-downloading the tarfile?

  3. annon says:

    I am running ubuntu 10 on 64 bit. didn’t work for me either. In step 4. sudo sublime, i get an error sublime is not found!

    • Jevin says:

      Ohh ! You’re right. I didn’t include the full path to /usr/bin in Step 3.
      I’ve modified Step 3. Can you try it again ?

  4. annon says:

    I copied the code for step 4, but I’m still not able to see Sublime’s icon in my desktop launcher. What can be the problem?

  5. annon says:

    Never mind I figured it out, had to reboot, now see the icon in the launcher. Thanks :)

  6. Jeremy says:

    When installing this way I can’t seem to install the package manager. When trying to install it I get [Error 13] Permission Denied

  7. mojo706 says:

    Hey there will this method work on my Gnome Desktop?MP

  8. bob says:

    Thanks so much dude!

  9. Brian S. says:

    Worked perfectly on a fresh install of 12.04. Thanks!

  10. Chris Heney says:

    Super helpful. I would recommend adding:

    That way it shows under the ‘programming’ category :)

  11. LouieGeetoo says:

    Thanks a bunch for this! Worked great in Linux Mint 12 64-bit. (I didn’t try the default file association part, but I’m sure it works too, seeing as Linux Mint is built on Ubuntu and all.)

  12. Ronak says:

    Worked perfectly on the latest ubuntu.

    Works like a charm. If you dont even read the explanation, it just works..!!! Good job..!

  13. joe says:

    there’s something strange in the sublime version, I have ubuntu 64 bits and of course I downloaded the 64 bits version which didnt work for me…after I tried to run the sublime_text script I got 3 files in the sublime directory with the “invalid encoding” legend same as kevin…I just change the version to 32 bits and this works perfectly….wft?

  14. carccc says:

    how can i unistall it???

  15. Jason says:

    This worked for me:

    sudo add-apt-repository ppa:webupd8team/sublime-text-2
    sudo apt-get update
    sudo sudo apt-get install sublime-text-2

    Running Ubuntu 12.04 LTS x64

  16. Matt says:

    Great Tutorial, The only issues I have found with the install are the following. Maybe someone could provide some incite? I am running this on an 11.10 x64 server OS. Those issues aside the program is fantastic and seems to be fully functional.

    When running sublime from terminal I see the following error:

    myuser@my-server:/usr/local/src$ sublime

    (sublime:10182): Gtk-WARNING **: Unable to locate theme engine in module_path: “pixmap”,

    (sublime:10182): Gtk-WARNING **: Unable to locate theme engine in module_path: “pixmap”,

    (sublime:10182): Gtk-WARNING **: Unable to locate theme engine in module_path: “pixmap”,

    (sublime:10182): Gtk-WARNING **: Unable to locate theme engine in module_path: “pixmap”,

    When opening the console in sublime I see the following error:

    Unable to write session file: /home/myuser/.config/sublime-text-2/Settings/Auto Save Temp Session.sublime_session

  17. Marie says:

    Thank you Jevin, this worked perfectly for me.

  18. CSJ says:

    Best to not put things like this in /usr/lib, but rather /usr/local/lib instead. /usr/lib is system stuff, /usr/local is for things added by the user.

  19. William says:

    Splendid. Thanks!

  20. Chris says:

    Very nice worked great once i figured out what bit my system was. uname -m to find out what bit your system is.

  21. Thanks, Jevin. This is such a lovely editor and really helped having your up-to-date install guide.

  22. Karthick says:

    Thanks a lot Jevin :)

  23. Adam says:

    Nice one, thank you!

  24. John says:

    This was an awesome and informative guide to installing Sublime Text 2, it’s so much better than Gedit. Thanks!

  25. Dizdane says:

    Your instructions worked perfectly, but everytime I start Sublime it automatically opens the sublime.desktop file at the same time. This is very annoying. Do you know how to make it stop doing this? Thanks.

  26. Marco says:

    Thank U, very usefull tutorial. bye

  27. HandsomeD says:

    When I start sublime it always opens default.list file like a start page. Could you help me with this ?

  28. Samuel Gavassi says:


  29. Karim Agha says:

    If your Icon is not showing up check to make sure the path written inside the sublime.Desktop file for the line that starts with “Icon=” is correct.

    I followed this excellent tutorial but isntalled in /usr/local/bin instead of /usr/lib/ and my Icon was not showing up. I realized then that the path declared inside the .Desktop file for the Icon was probably incorrect.

    Thanks for the excellent tutorial!

  30. Found it really really helpful. Thanks a lot. Keep up the good work.

  31. SirLenz0rlot says:

    I’m not sure at which point Sublime creates its ~/.config/sublime-text-2 directory, but because of doing all your steps as superuser, the configuration is owned by root.
    Not best practise to have these files in your home directory i think (e.g. you cannot save your user settings)

    Afterwards, did something like:
    cd ~/.config/
    chown -R : sublime-text-2/
    (where you put the owner of that home directory)

  32. Bob says:

    Very useful post, many thanks. This is one of the first actions I do when jumping on a new ubuntu system :)

  33. Brian Kung says:

    Hmm, now when I open a directory in sublime with “sublime .” it’s opening two windows, which is very irritating. Any idea how I can fix this?

  34. milan-j says:

    I’ve used your method to install Sublime Text 2, and now I can use this approach for any other similar problem. I thank you for that, you taught me something very valuable.

  35. Ollie says:

    Thanks, worked great. However sublime doesn’t show up in the application switcher, does anybody know why this might be?

  36. To fix the problem Ollie has, there is a quick fix.
    In the sublime.desktop file you need to declare how the application handles files. So instead of “Exec=sublime” you should put “Exec=sublime %F” which in essence says that sublime text accepts multiple files (“%f” would be a single file and with “u” (same syntax) you say it accepts a single or multiple URLs).
    With this quick fix sublime text will show up in the application switcher and the context menus.

  37. vinit says:

    Thanks man!

  38. edubkendo says:

    Can you tell us how you do updates since there is no longer a repository? (the unofficial one was deleted very recently)

  39. Alex says:

    Thanks, very helpful

  40. Ernesto says:

    Thanks men! very useful tutorial.

  41. Manfred says:

    Awesome article – thanks for sharing :-)

  42. roblav96 says:

    wow thank you very much!!!

  43. Valeriu says:

    Thanks for the cool tip – love sublime!

  44. Robin Clark says:

    Thanks for the walk through, much appreciated. Worked a treat for me, it’s so sublime…

  45. clark says:

    This takes freaking 3 seconds to do in Windows. In Ubuntu I need 15 minutes and 3 tutorials (this, how to open nautilus in sudo, and how to find my user files in nautilus while started with sudo). Seriously, it’s no wonder why linux hasn’t made it anywhere in the consumer sector so far.

  46. Kyle says:

    How did you get Sublime to pin to the Application Bar? I can’t seem to figure it out. When I launch it from Terminal, it doesn’t show up like any other app would on the Bar. I can find it in Dash, but I can’t pin it from there.

  47. Jabril says:

    Thank’ a lot. mister Genious !
    It works perfectly, but i don’t have the icone of Sublime …

  48. Philippe Idlas says:


    It worked nicely until I loaded the new version and decided to replace Sublime Text 2 folder with the new one. From that moment I could not run the package anymore with an error message saying :

    Unable to run package setup:

    Traceback (most recent call last):
    File “./”, line 165, in upgrade
    upgradePackage(pkg, pristinedir, datadir, backupdir)
    File “./”, line 158, in upgradePackage
    os.path.join(backupdir, base), inhibitOverwrite)
    File “./”, line 113, in upgradeArchive
    shutil.copy(src, dst)
    File “.\”, line 88, in copy
    File “.\”, line 53, in copyfile
    IOError: [Errno 13] Permission non accordée: u’/home/philippe/.config/sublime-text-2/Pristine Packages/Groovy.sublime-package’

    I then decided to go with ppa but I have exactly the same error message.

    Would you be kind to assist me in trying to understand what is wrong with my configuration ?

    Thanks in adcanve.

    Best regards.

    • max says:

      are you using with SUDO ?
      sudo sublime .

    • Philippe Idlas says:

      Hi everybody,

      Coming back to you to let you know what I did to solve my problem.
      Delete in .config repository (hidden file in /home) the sublime-text-2 repository.

      That’s all folks.


      Philippe Idlas.

  49. Brian Andersen says:

    Thanks man. Just what I needed.

  50. BigAB says:

    How would one update Sublime Text 2 after using this method?

  51. hellbinder says:

    Everything worked fine. Now i want to add new packages. I got some for Rails and it says to move the files to the packages. The only way to do this is from the command line using sudo?

    I can’t drag and drop. Why would this folder be a root permission?

  52. raju says:

    Thanks buddy,
    followed the steps to setup on ubuntu 11.10
    Its worked.

  53. Gregory says:

    Very good, tks!!

    Its worked.

  54. Nazmul Chowdhury says:

    Sublime Text 2 [UNREGISTERED]

    Why ???

  55. Nazmul Chowdhury says:

    Sublime Text 2[UNREGISTERED]


  56. Maciej says:

    Hello. I followed up your tutorial and i got some problems. I cannot save my personal settings (sublime is saying it cannot save into .config). Additionally, when i close it, it doesn’t remember last modified files, it opens first files that was opened with sublime like “deafults.list”

    • dmoney says:

      I’m having the same issue with remembering open files. It will open the first file instead of the files I had open the last time i used sublime. Was there ever any fix to this?

      • Andrew H says:

        Fixed it. It’s a permissions problem. Do “$ sudo chmod 777 -R ~/.config/sublime-text-2 ” (no quotes, no dollar sign) in the terminal, and you’ll be good to go. Note though, that this is universal read/write, and may not be the most secure… if someone else could offer a more secure setting that’ll work, that’d be great.

        • Brandon says:

          Set correct ownership:

          “$sudo chown -R username:username /home/username/.config/sublime-text-2″

          Set correct permissions on files and directories using find and xargs:

          “$sudo find /home/username/.config/sublime-text-2/ -type d | xargs chmod 775″

          “$sudo find /home/username/.config/sublime-text-2/ -type f | xargs chmod 664″

          Of course, omit quotes and dollar sign for commands.

    • Andrew H says:

      I’m having the same problems. Trying to save personal settings gives me ” Unable to save ~/.config/sublime-text-2/Packages/User/Preferences.sublime-settings”. And when opening Sublime, i’m greeted with the sublime.desktop and defaults.list files, rather than my last opened project. I’m not sure what to do.

  57. Daryl Tucker says:

    Using this method, Sublime does not show up as an option when I try to ‘Open With’ > ‘Other Application’.

    Any suggestions?

  58. Ankur says:

    Thanks so much. I was facing bit of problem by moving sublime in bin etc.
    But your simple tutorial solved the things for me.

  59. Maien says:

    Thanks indeed for posting these steps. However, the last step didn’t work for me. Gedit is still the default editor. Also, sublime is not included in the “other apps” list to choose it as a default app. Do you know how to fix this?
    Many thanks,

  60. b3n says:

    how d’you change font?

  61. Adrian says:

    Hi everyone,

    you see, this is my problem:

    I find sublime “icon” anywhere, also I made the substitution in the defaults.list and this did not work to set sublime as default.

    Any idea?

    • b3n says:

      you have this file, right?

      are you getting an error when opening text files?

  62. Tom says:

    I have Sublime installed and working just fine with all of the extensions for rails etc.

    Now I would like to update Sublime to the latest version.

    Has anyone done that or can someone give me some direction on how to do this.


    • Tom says:

      I decided to use the WebUpd8team Sublime Text 2 PPA on Ubuntu with the following:

      sudo add-apt-repository ppa:webupd8team/sublime-text-2
      sudo apt-get update
      sudo apt-get remove sublime-text* (optional- I used it since I had a sublime version installed)
      sudo apt-get install sublime-text … this installed the latest version

      I was informed on the Sublime forum that any extensions etc are installed in a seperate folder so updating will not affect those settings.

  63. Dan M says:

    Thanks for the tutorial. I think there is one step missing that prevents preferences from being saved. I am guessing this is due to steps 4+5 where we run sublime as root. I suspect if we ran it once as a normal user this wouldn’t be an issue, but adding this as step six resolves issue.
    sudo chown -R $USER:$USER $HOME/.config/sublime-text-2/

  64. Filipe says:

    Thanks Dan. That solved my problem of being unable to save Sublime default preferences.

  65. Kurtis says:

    Thanks! Works well for the Gnome Shell on Ubuntu 12.04 as well.

  66. umpirsky says:

    Great, thanks.

    Only problem I see is icon, when I put 48×48 it is blurred in app switcher (Alt + Tab), when I put 128×128 it is ok in app switcher, but blurred in launcher.

    Any idea?

  67. Ankur says:

    I have followed this guide but I am having I problem.

    When I type “sublime” in terminal, thee sublime open app works well and launcher in unity is highlighted correctly.

    Now I made sublime to be my default app for opening C Source Files. ( I used MyUnity App)

    Now whenever I open and C ( ie .c ) file , sublime opens it well but I get no icon in unity for sublime. Also the previous sublime icon which I have used as described in your post is not highlighted.

    Image Attached :

    Please help.


  68. Ryan O'Hara says:

    There’s a little problem with permissions here; I just did a `chmod -R 0777 ~/.config/sublime-text-2`. Then preferences are saved and you can install Package Control and activate and all without needing sudo. Also, if you’re using the default Unity and everything, the 128×128 icon works better in the Dash (but it *is* a little fuzzier in the Launcher).

  69. josh says:

    To get sublime to open and not hog your shell…

    function sublime() {
    /usr/bin/sublime “$@” &

  70. Works perfect :D, Thank you very much!

  71. Jan says:

    Thank you Kevin! Works perfectly! =)

  72. Jan says:

    ohh! Jevin! not Kevin. Sorry! :)

  73. Alain O'Dea says:

    Jevin, this worked beautifully for me. Thank you :)

    Sublime launches a lot faster than GEdit for me and obviously buries it in every conceivable way as a serious text editor.

  74. Manoj says:

    Thankyou..very helpful for linux beginners

  75. Eric Pace says:

    Hi all,

    Had a problem setting Sublime as the default editor for PHP files. The problem was that Sublime does not show up the applications list when selecting ‘Open with other application’.

    Basically all you need to do is edit sublime.desktop:
    sudo sublime /usr/share/applications/sublime.desktop

    then replace:

    Exec=sublime %f

    Found the solution in a similar thread on Nedit:

    Hope this helps!

  76. Waldyr says:

    I wrapped this idea on a script to auto setup on Ubuntu environment. If you guys wanna take a look. It installs Sublime and have some addons such as a custom better icon and Zen Coding setup. If you guys wanna see just go to my repository

  77. varun says:

    thanks man,very useful

  78. Rolandas says:

    That was very helpful, thanks!

  79. Sergey says:

    Thanks man, You save my day)))

  80. dominic says:

    Really nice instructions, I’ve almost never used linux/ubuntu and this worked straight off thanks

  81. sapardi says:

    Thanks you so much Jevin, it’s awesome tutorial….

  82. Rony says:

    Muchas gracias me fue de mucha utilidad. Siga asi.

  83. kris says:

    Thanks for the post,

    I want a little thing more that how I can set the .html or other kind of files to be open by default in PHP file.


  84. Andres says:

    Great post… thanks man!

  85. machv5 says:

    Everything ran OK. However I ran into a few problems some I worked around. (I am using Ubuntu10.04LTS)
    I ran into difficulty when I tried to change the Icon for the sublime.desktop to the sublime text one. I kept getting u arent the owner. So I tried to change the permissions

    me@home$ sudo -i
    root@ubuntu$ chmod -rw-r–r– sublime.desktop -rwxrwxrwx sublime.desktop

    This changed the permissions to ————- sublime.desktop
    GRRRRRR….. What did I do wrong. I tried to change them back and then to anything else and no dice. I have tried sudo infront of the command while root and still nothing. Till I either get a reply from you or find the answer someplace else I am deleting the directory (which I can only do through the terminal) and going with the regular Icon. I have the Icon set right on the panel I added it too. I just like things to be neat and tidy and this is why I want to have the Icon on the file like all the others do in that folder. I am moving over to Ubuntu from Windows and I want to have the same level (if not greater) of control and ability to modify/do all in the terminal and ubuntu environment. I am transfereing to Ubuntu as well because I am learning to become a developer of android apps and building custom roms and want to work in Linux noit Windows. I just hate the beggining of a learning curve it’s the most tedious as all the information is sorting in my head and starting to make sense and understood. especially when learning new terminology and trying to make links as to the Windows equivalent. Like Windows calls it a cmd.exe linux is terminal. dir is ls etc… Anywho thanks for the how-to I learned a lot and will be applying what i learned for other instances, thanks man.

  86. karliic says:

    I just installed the sublime as it was mentioned here on Ubuntu 12.04.

    But every time I open the editor, it opens me sublime.desktop and defaults.list file in it instead of the project, that I was editing before closing the editor.

    Can anyone help me how to solve this?
    I’m quite new to Linux

    • Jim Barrett says:

      I noticed the same thing. Not sure why or how, but when you open sublime with root privileges (‘sudo sublime’ in terminal)…if you close sublime with files open these will be open every time you open sublime. So to prevent these two files being open when you start sublime you’ll need to ‘sudo sublime’ and close both of these files, then close Sublime. Now open using the shortcut and you’ll notice that these are no longer open by default.

      Not sure about how to automatically open the last project you were working on, unless you leave it open while logged in with sudo permissions.

      Hope this helps!

  87. Jim Barrett says:

    Worked first time on both Ubuntu and lubuntu (12.04). Thanks a ton!

  88. machv5 says:

    In Windows when I notice things like that happening I check the “settings – default” under preferences tab. Sometimes values change or revert after updates or adding new packages (from what I remember happening to me) or get replaced by a backup if they get corrupted (at least I think they do on the last part if not maybe they should lol) Anyway it’s been a while since it happened to me so I may not have total accuraccy on events leading to.
    Moving on, as I was saying I normally edit the settings using sublime. However I noticed that after I moved the files over to usr/lib etc… That I am no longer able to save my changes I think that this may likely be due to the new location that they are in. As messing around in those folders can result in horrid repercutions. I accidentally deleted my whole lib folder because I edited an older saved command and then forgot to add the folder in lib I wanted to delete thereby deleting all of my installed programs. I had to laugh luckily it was only a few days old and not fully setup properly and I save my docs etc… to another partition.

    Anyway there may be something to do with permissions (I am nub too and don’t know for sure) having a part in it. Similar things happens in Windows when opening a game as administrator rather than normally (even if you are using an admin account at the time) your saved games are not listed. It happens more with games than other programs I notice likely due to the relationship with specific users saved files. Before I “installed” sublime to usr/lib I was just using it from the folder where I extracted the folder and everything was running OK. And in reality all you are doing (from what I see) is just extracting the files form the archive then moving them to the OS’s user programs folder, then creating a shortcut to it and putting it’s parameters etc on how it should behave etc… into the OS’s folder where it keeps those files. I have an idea that I think will work and at the same time lessen any potential damage that I can be wrought by my inexperience with Linus and it’s to create a folder where I put all of the programs I download that isn’t in a restricted area like usr/lib and then to create shortcuts to its executable that I can then I add to the panel or to one of the program menus. That way I will still be able to use the program without cluttering up the desktop with shortcuts (which annoy me) and alter any settings from time to time. Or just config the settings before I move everything over to usr/lib. I also have another couple of ideas that may work as well. Anywho I think I have gone on long enough. I anyone has any added input on what I have written or can shed more light on manually installing software via the terminal I am all ears. Have a great day and if I run into any problems with my idea I will post them.

  89. Flonka says:

    Awesome tutorial, worked like a charm! Thanks!

  90. Bug says:

    Perfect! Works like a charm!

  91. Tiroly says:

    Nice ! Juste perfect work, better than some other ways.


  92. Lionel says:

    If you want to install sublime text use this:

    With the method above you may experience problems with file permissions. For Example I could not get Package Control to work.
    If you have used the above method you can uninstall it by undoing all your steps in reverse order.

    Hint: Remember to remove ~/.config/sublime-text-2 folder before installing again.

  93. Sasha says:

    Sorry for my English. This is not my first language.

    Thanks for the instructions. Now I can install ST2 without repo.

    I have a question: how I can to add ST2 in right click context menu? I google it… but all ways – it’s to use “Nautilus Actions” and and similar programs.


  94. Tony Jian says:

    Hello, I want to know why you put the folder into /usr/lib instead of /usr/local/lib.

  95. Matt Lemmon says:

    Thank you!!! Very helpful!

  96. Sinan Erdem says:

    I beleive a better method is to install the package via Synaptic. Running “sudo synaptic” and selecting sublime text to install, just makes everythink ok for me.

  97. che says:

    Thanks for this tutorial. It is very userful.

  98. deepak says:

    In terminal subl shortcut not working (how to add shortcut for sublime)

  99. shallker says:

    Before get yourself into trouble, go read this page

  100. WEL says:

    I did this on Arch Linux and it worked fine, but I moved the install directory from /opt to /usr/lib. I screwed up the link a few times, but other than that, it was great. Thanks!

  101. Jeffrey Thompson says:

    Hey, just simply add it to your packages for use with your package manager:

    sudo add-apt-repository ppa:webupd8team/sublime-text-2
    sudo apt-get update
    sudo apt-get install sublime-text

  102. Jeffrey Thompson says:

    Hey, just simply add it to your packages for use with your package manager:
    sudo add-apt-repository ppa:webupd8team/sublime-text-2
    sudo apt-get update
    sudo apt-get install sublime-text

  103. mustafa says:

    it works, thanks a lot

  104. Pawel says:

    Thanks for this tutorial! It’s working very good right now!

  105. Nael says:

    Thanks a lot for the clear explanation. I have one question: how can we create an access to the application in the Ubuntu gnome desktop dropdown menu, for example into Applications > Programming?

  106. David says:

    How can one uninstall Sublime text installed using this tutorial? I’m not sure exactly how one can remove all the connections by doing “reverse.” What commands constitutes reversing? (I’m new to Ubuntu.) For an example of the difficulty I am having, there is sublime-text-2 folder in the home/.config folder. However, when I try commands like “sudo apt-get remove sublime-text-2″ from the home/.config folder, I receive an error message “Unable to locate package.”

    On a bigger note, the problems with this tutorial for me were 1) Doesn’t properly install Unity taskbar icon and 2) Terminal becomes unusable after launchiing Sublime and 3) Sublime is not accessible in the software center … which is why I want to uninstall it and use a different installation process.

    • If you install in ~/opt, link executable to ~/bin/sublime and put your gnome desktop icon info in ~/.local/share/applications/sublime.desktop as described in the AskUbuntu answer here:

      then you can just delete those files/folders (~/opt/Sublime\ Text\ 2, ~/bin/sublime and ~/.local/share/applications/sublime.desktop). DONE!

    • Oscar David Arbeláez says:

      If you didn’t find an answer yet, here is something, through this tutorial, you manually did set the links to get the application integrated to the desktop, to remove the application you just need to do the inverse process, actually any order can serve to the purpose, the only thing you really need to do is undo the last step, replace the occurrences of sublime.desktop by gedit.desktop so the default application for all those file-types is not sublime.

      * If you remove the sublime.desktop file in /usr/share/applications/ you remove the icon from unity.
      * If you remove the soft link at /usr/bin/sublime, you automatically remove it from your PATH, so when you type sublime in your terminal an error will prompt and Sublime wont be launched.
      * If you erase or remove the Sublime Text 2 folder from /opt/ you are actually removing the application info from your computer, this operation will free the hard disk space.

  107. edward says:

    Can anyone tell me why the fuck you people use all this unix crap instead of Microsoft. Can we please nuke unix and all associated sofware?

  108. Majda says:

    Exactly what I was looking for! Now I can use Sublime Text more easily. Thanks a lot :)

  109. Chris Gibson says:


    Very helpful! Worked first time.


  110. someone else says:

    Hey, if you replace



    Exec=sublime %f

    It will allow you to open files using right-click > Open With in Nautilus. It can be useful.

  111. John Buckley says:

    Thank you very much!

  112. Thanks for updating your site to conform with this AskUbuntu post [1]. I wish you would change steps 3, 4, & 5. If users wish to do a system wide install then perhaps they are better off using the PPA for sublime-text-2 by webupd8team [2]. The recommendations here still involve altering /usr which is a system filesystem, and can only be edited using root privileges, and for good reason, they will interfere with updates/upgrades by package-manager. A better solution is to symlink the executable to your ~/bin folder, which is always on your path, and then alter the gnome desktop settings in ~/.local/share/applications/. These AskUbuntu answers [3, 4] provide directions for creating a desktop/launcher icon that doesn’t require root privileges or interfering with Ubuntu’s core system. (Full-disclosure – ref [4] is my post.)


  113. Elly says:

    Thank you very much for this! I’d be running it out of my home folder and so Ubuntu didn’t know of it’s existence! This is way better.

  114. Amir says:

    Thank you, this helped me alot

  115. moenet says:

    sublime: command not found in STEP 4
    i use ubuntu 12.10

  116. Works perfectly, thanks! I might add, the icon looks better in the dash if you use the 256×256 version in sublime.desktop.

  117. Jerry says:

    Another way to do it is installing Ubuntu Tweaks (which is a must have program for Ubuntu). Program has sections “programs” which acts kinda like Ubuntu Software Center. And among these programs is Sublime Text 2 and also its developer version. :)

  118. Grim says:

    Great tutorial, thanks for the assistance!

  119. bounasser says:

    thx it works fine 😉

  120. Adarsh says:

    I don’t see why you should do all this when just adding the PPA can do things for you.

  121. Djonatas Tenfen says:

    Thanks Very good post 😀

  122. bro, help i struggling in some problems, and can not perform installation

  123. Girogio says:

    Thanks so much; very useful for Linux noobs! :)

  124. Renatiux says:

    Great! Thanks for the detailed info.

  125. Ross says:

    Thanks for this tip!

  126. Dave says:

    Thanks a lot, this was extremely useful!

  127. aza says:

    Thank You!

  128. Saul Spatz says:

    The file associations don’t work for me. I edited /usr/share/applications/defaults.list as recommended (except that the command is subl rather than sublime) , but when I click on a python file for example, it opens in gedit. Here is the line from /usr/share/applications/defaults.list:


    The word “gedit” appears nowhere in the file. If I type “subl” at the command prompt, sublime opens as you would expect.

    I don’t even know where to look. Have you any suggestions?


    • Saul Spatz says:

      I think I know what the problem is. When I put the sublime.desktop file in /usr/share/applications, no icon shows up on my desktop, so I put it in my Desktop directory instead, naming it subl.desktop. Apparently, the files referred to in /usr/share/applications/defaults.list won’t be found in my Desktop directory.

      Have you any idea why the icon doesn’t show up? I do have other .desktop files in my Desktop directory.

  129. Saul Spatz says:

    Yes. I even copied the path from the .desktop file and pasted it into the terminal to check. I did find some information on why the file associations didn’t work. According to Ask Ubuntu , at

    you need to have MIME types in the .desktop file. Examples are given in the Sublime Forum at

  130. VioletZun says:

    Thanks! This is totally awesome.

  131. Kevin says:

    That worked perfectly! Thank you!

  132. Kevin says:

    Errrr… one thing though: my icon on launchpad opens up to sublime.desktop instead of a new clean window. Any idea on how to make it work? Thanks!

  133. Kevin says:

    hey! nevermind i got it! it saves how it last shut to open just like it. thanks!

  134. honesta says:

    Thanks a lot for this. Though I have an issue, everytime I open sublime it doesnt show me the last files I have opened but still shows the sublime.desktop and defaults.list files.

    Anyone knows how to fix it?

  135. Kevin says:

    Honesta, before closing Sublime, try closing the separate tabs first. Re-open, see if it works.

  136. CAV says:

    Thank you. Extremely helpful and straightforward =D

  137. JD says:

    Awesome thanks for the simple guide!!! I didn’t know how to associate the icon

  138. ginanjar says:

    Hey, thnks for share.
    It’s works! ;D

  139. picharnan says:

    Thank you very for the solution :)

  140. Denis says:

    This was very helpful. You are life savior. Thanks

  141. Jhonny says:

    Hi mate. Does it works only for the 64bit version? I need to install the 32bit one.

    Anyway I run your code and this is what I get:

    ~$ tar xf Sublime\ Text\ 2.0.1\ x64.tar.bz2

    tar: Sublime Text 2.0.1 x64.tar.bz2: No se puede open: No existe el archivo o el directorio
    tar: Error is not recoverable: exiting now


    Any help? Thanks in advance!

  142. Jhonny says:

    *”No se puede open: No existe el archivo o el directorio” means “Can’t be opened: File or directory doesn’t exist”


  143. Kevin says:

    thanks! now i can use my favorite text editor without a problem.

  144. Jake says:

    This way of doing things is utterly and completely wrong.

    For the correct method see this article:

  145. Thanks says:

    Thanks for the post! It’s very useful

  146. Max says:

    Use instead:
    sudo add-apt-repository ppa:webupd8team/sublime-text-2
    sudo apt-get update
    sudo apt-get install sublime-text

  147. Pankaj says:

    Thanks, awesome tutorial. helped a lot. I was just wondering why can’t I install sublime with apt-get ?

  148. rashid says:

    you made my day! thanks a lot for sharing!

  149. Gene says:

    Thanks, very helpful and informative

    • Gene says:

      Actually, I think the above comments are right about the correct way to do this, but this is still useful to see the manual steps.

  150. retnan says:

    Nice One – It worked

  151. chris says:

    Clap – clap – clap – clap.

    Thank you!

  152. Mohammed says:

    Thanks alot for this!

  153. Arjan says:

    Nice tutorial. One problem, though. If you start sublime the first time with sudo, the ownership in ~/.config will be set to root:root causing all sorts of problems.

    So you might want to add that you have to open sublime atleast once as normal user before using sudo sublime.

  154. Nick says:

    Not sure If I need to do step 4 or if I understand step 4. What do you mean by “Create a luancher in Unity”?

    Thanks though, this worked,


  155. Nick says:


    I did all the steps you taught and sublime is not appearing in the dash and when I run the command “sublime” sublime text opens but when I close the terminal sublime closes too.

    I am using ubuntu 13.04. How do I reinstall?

  156. vilas says:

    wil this installation works for 32 bit ubuntu

  157. vilas says:

    will this works for 32 bit ubuntu

  158. Nick says:

    Never mind I fixed it. Villa, it should work in 32 bit Ubuntu just download the 32 bit for Linux:

  159. Steel says:

    Is sublime text 2 free to use on Linux ? it says unregistered.

  160. Nick says:

    Yes it is. However, every now and then it will prompt you to purchase it. Might seem annoying but it is so so worth it cos it is free. Paying for it is giving back to the developer and you might possibly get updates or something. But yea it is free.

  161. noob says:

    Lol, this is really pathetic, all those brainiacs working on linux and they cannot handle simple app installation without terminal and problems. Like typing bunch of command will make me smarter.

    • Nick says:

      Lol who said we were brainiacs? I have heard no such boasting? Who said command line makes anyone smarter. Nub

  162. Nick says:


    Thanks for this, but I need help with a problem when following the instructions.
    After installation, the files : “sublime.desktop” and “defaults.list” is left in sublime text editor. Whenever I open sublime these files are always there. How do I prevent that?



  163. Santosh says:

    Thanks! Very useful.

  164. Jashwant says:

    Perfect tutorial.

    Just one thing,

    %U in sublime.desktop to have ‘open with sublime’ in files.

    [Desktop Entry]
    Name=Sublime Text 2
    # Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
    # From Ubuntu’s language-pack-kde-XX-base packages, version 9.04-20090413.
    GenericName=Text Editor

    Exec=sublime %U
    Icon=/opt/Sublime Text 2/Icon/48×48/sublime_text.png

    [NewWindow Shortcut Group]
    Name=New Window
    Exec=sublime -n

  165. Great stuff broda .. Thanks for your help

  166. Alonso says:


    When I tried the step 4, it gives me an error: sudo: sublime: command not found.
    Is there any fix for that?

  167. Alain O'Dea says:

    Thank you Jevin.

    This is solid. I modified it slightly because I have Sublime Text in ~/Applications, Sublime Text now has a 256×256 icon, and the executable is now called sublime_text. I had to provide a full path in Exec and NewWindow Exec in quotes as “/home/alain_odea/Applications/Sublime Text 2/sublime_text”.

    This took me all of 3 minutes to get working thanks to your post.


  168. Steven Van Selus says:

    This is just what I was looking for, and it worked perfectly! Thanks for the detailed, step-by-step instructions. I’ve got Sublime fully integrated with my Ubuntu 12.04 as a result.

  169. Ryan says:

    Had the same problem, but there’s a way better way:

    sudo add-apt-repository ppa:webupd8team/sublime-text-2
    sudo apt-get update
    sudo apt-get install sublime-text

    They should say that on the download page!

    Here’s where I found it:

  170. Orestarod says:

    I was wondering, is there any way to detatch the sublime from terminal, after I start it from there? I mean, how can you make the terminal close or show a usual input prompt, after I press the sublime command in the terminal?

    • domepro says:

      add an ampersand after the command.

      #sublime &

      • domepro says:

        p.s. I’m not sure if you can close the terminal after this technique ( I presume sublime would get killed if you close the terminal window since it is a process in that terminal), but you can use the terminal normally after starting sublime (or vim, or some random application) this way

  171. Ron Phillips says:

    I have Sublime Text installed, but I have to start it with sudo to get my config changes to persist. Is there a way around this?

  172. Thanks!
    Simple to follow and worked perfectly

  173. First, webupd8team’s repository install mono, which is ridiculous, so I don’t use that repo.

    Second, all the “sudo sublime ..” in this tutorial should be replaced with “sudo nano ..” or you won’t be able to install any packages or color schemes or anything.

  174. Cafestop says:

    I just moved to ubuntu and sublime text is my favorate, thanks a lot.

  175. Phage says:

    Any one please how to delete it.

  176. ednilson says:

    Very good!
    Thank you Jevin!

  177. Ani-Gizzle says:

    Meticulously written and very resourceful. Thank you!

  178. Cybe says:

    Great tutorial man! Will bookmark this.

  179. i thank you for this great tutorial.
    Even know i am using elementary OS (which is based upon Ubuntu but does not use Unity) this works perfectly

  180. Joseph Rex says:

    This is totally awesome! Works fine with my Ubuntu 12.04

  181. Julius G says:

    Thanks for this. Works for me

  182. Dank says:

    Thanks for the guide. I have one question though. Whenever I open the program from the dash it always opens sublime.desktop and defaults.list. Is there any way to stop it from opening those every time?

  183. Mike Herrera says:

    Works like a champ with Kubuntu 13.04! Thanks a bunch!

  184. Chris Adams says:

    Thanks! That worked perfectly.

  185. Yavuz says:




    Use instead:
    sudo add-apt-repository ppa:webupd8team/sublime-text-2
    sudo apt-get update
    sudo apt-get install sublime-text

  186. Sachith says:

    just do this,

    sudo add-apt-repository ppa:webupd8team/sublime-text-2
    sudo apt-get update
    sudo apt-get install sublime-text

  187. Mandar says:

    Hey, Thanks a ton!
    It worked absolutely fine for me..

    Sublime is awesome text editor. Not only for Simple text editing, but it’s just great for the coding purposes.

    I am not going back to gedit again.
    Thank you!

  188. Kiash says:

    Thanks! It works for me. :)

  189. Cyb3 says:

    Hello, awesome tutorial but when i am entering my license it disappears when i’m opening the program again. This is frustrating, how do i fix this? And also, when i’m opening Sublime again it shows up a tab with the file “defaults.list”.

    • Ron says:

      Yeah, that’s the problem with the original instructions. Look at Yavuz post from Sept. 30. First, remove the bad install by using the instructions I posted, then install using Yavus’ instructions.

      • Cyb3 says:

        Hi again,

        Thanks, i missed that! I’ve now installed it and it pops out an error for me:

        “Unable to run package setup:

        Traceback (most recent call last):
        File “./”, line 165, in upgrade
        upgradePackage(pkg, pristinedir, datadir, backupdir)
        File “./”, line 158, in upgradePackage
        os.path.join(backupdir, base), inhibitOverwrite)
        File “./”, line 113, in upgradeArchive
        shutil.copy(src, dst)
        File “.\”, line 88, in copy
        File “.\”, line 53, in copyfile
        IOError: [Errno 13] Permission denied: u’/home/cybe/.config/sublime-text-2″

        • Ron says:

          Looks like you might need to run that second command

          “sudo chown -R username:username /home/username/.config /sublime-text-2″


          • Cyb3 says:

            Hi again,

            It worked to launch it now and i had to enter this line also to get it going:

            “sudo chown -R cybe:cybe /home/cybe/.config/sublime-text-2/Pristine\ Packages/Java.sublime-package”

            But the tab is always there still… Is there something else i have to do?

  190. Thanks man, works like charm 😉

  191. Anon says:

    I’ve been searching all over Google on how to add Sublime Text 2 to dashboard. Only your method works like charms. Thank you Jevin!

  192. Alex says:

    Thank you guy so much for posting this!! I’m just getting started with c++, and I hear this is one of the best UID’s out there! Thanks again!!

  193. Denn says:

    Thank you! Detailed and very helpful!

  194. Wolfy says:

    Step 4 gives me
    “ImportError: No module named PackageSetup”

  195. Kalintosh says:

    Thanks man. It worked perfectly fine. You just have to work harder. Not every single step this blogger made will be the same with your PC’s. For example, the exec file was sublime_text and I swapped that in place of sublime. That’s why those who used sublime failed to have it work.

  196. Shaifali Agrawal says:


  197. enrico says:

    Thanks man, very useful, worked out of the box

  198. Pierre says:

    Plus rapide :
    $ sudo add-apt-repository ppa:webupd8team/sublime-text-2
    $ sudo apt-get update
    $ sudo apt-get install sublime-text

  199. Jose Correa says:

    Thanks! It happens very well!

Leave a reply