Skip to content

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:

Published inWeb
  • kevin

    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

      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. =/

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

  • annon

    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!

    • 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 ?

  • annon

    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?

  • annon

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

  • Jeremy

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

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

    • Yep. Just omit Step 4, cause that’s for Unity only.

  • bob

    Thanks so much dude!

  • Worked perfectly on a fresh install of 12.04. Thanks!

  • Super helpful. I would recommend adding:

    That way it shows under the ‘programming’ category 🙂

    • Niiice, I updated the post to add that. 😉
      Thanks Chris

  • 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.)

  • Ronak

    Worked perfectly on the latest ubuntu.

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

  • joe

    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?

  • how can i unistall it???

  • Jason

    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

  • Matt

    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

  • Thank you Jevin, this worked perfectly for me.

  • CSJ

    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.

  • William

    Splendid. Thanks!

  • Chris

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

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

  • Karthick

    Thanks a lot Jevin 🙂

  • Adam

    Nice one, thank you!

  • John

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

  • Dizdane

    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.

  • Pingback: » Як заставити VLC Media player відкриватись в одному вікні Замітки програмуючого програміста :)()

  • Thank U, very usefull tutorial. bye

  • HandsomeD

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

    • HandsomeD


      • Pete

        How did you solve it? I am having the same problem.

        • Evan

          See SirLenz0rlot’s post below.

  • Samuel Gavassi


  • Karim Agha

    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!

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

  • SirLenz0rlot

    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)

    • Evan

      I also had to do this. Jevin, please include a step in your guide to take ownership of this folder. Otherwise, Sublime won’t open all of your previously opened files, and you won’t be able to edit the files listed in the Preferences menu.

    • The easiest solution to this problem is to open sublime the first time without a sudo command, it creates these files the first time you start sublime text. So if you start the first time as root the files will be made as root, if you start normally the files will be yours and everything will work normally.

    • Andy

      can you elaborate on what to put in the chown comand?

  • Bob

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

  • 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?

  • milan-j

    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.

  • Ollie

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

  • Pingback: Sublime Text 2 telepítése | Bólogatás()

  • 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.

  • vinit

    Thanks man!

  • edubkendo

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

  • Alex

    Thanks, very helpful

  • Thanks!

  • Thanks men! very useful tutorial.

  • Manfred

    Awesome article – thanks for sharing 🙂

  • roblav96

    wow thank you very much!!!

  • Valeriu

    Thanks for the cool tip – love sublime!

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

  • clark

    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.

  • Kyle

    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.

    • Matt


      Usually you can drag from the application window to the application bar, then you can pin it.

      • Kyle


        I’ve tried that, and it doesn’t work.

      • Kyle


        Nevermind, it appeared on the Application Bar after a restart.

  • Jabril

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

  • Philippe Idlas


    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

      are you using with SUDO ?
      sudo sublime .

    • Philippe Idlas

      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.

  • Brian Andersen

    Thanks man. Just what I needed.

    • Philippe Idlas

      Good for you but it does not really help me!
      Someone could give me a clue ?

  • BigAB

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

  • hellbinder

    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?

    • Faust

      You can just enter ‘sudo nautilus’ and then move your files where you need to 🙂

  • raju

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

  • Gregory

    Very good, tks!!

    Its worked.

  • Nazmul Chowdhury

    Sublime Text 2 [UNREGISTERED]

    Why ???

  • Nazmul Chowdhury

    Sublime Text 2[UNREGISTERED]


  • 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

      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

        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.

        • 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

      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.

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

    Any suggestions?

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

  • Maien

    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,

  • b3n

    thanks !

  • b3n

    how d’you change font?

  • Adrian

    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

      you have this file, right?

      are you getting an error when opening text files?

  • Tom

    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

      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.

  • Neto


  • Dan M

    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/

  • Filipe

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

  • Kurtis

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

  • 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?

  • Pingback: Instalando sublime text 2 no ubuntu 12.04 (unity) | Daniel Lemes()

  • HI
    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.


  • 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).

    • I would highly recommend not using 777. Very insecure. Try my suggestion above using find and xargs.

  • Pingback: Ficando Zen com Sublime | Thiago Galbiatti Vespa()

  • To get sublime to open and not hog your shell…

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

  • Works perfect :D, Thank you very much!

  • Jan

    Thank you Kevin! Works perfectly! =)

  • Jan

    ohh! Jevin! not Kevin. Sorry! 🙂

  • 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.

  • Pingback: How to install Sublime Text 2 on Ubuntu 12.04 (Unity) | A Place For Poor Examples()

  • Manoj

    Thankyou..very helpful for linux beginners

  • Eric Pace

    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!

  • work like a boss!

  • 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

  • Pingback: Sublime Text 2 | MPCA's blog()

  • varun

    thanks man,very useful

  • Pingback: Apple Town Prince » Blog Archive » Ruby on Rails Development Setup()

  • That was very helpful, thanks!

  • Sergey

    Thanks man, You save my day)))

  • dominic

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

    • Welcome to the linux community, if you are indeed now using sublime on linux. 🙂

  • Pingback: tonyfy()

  • sapardi

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

  • Rony

    Muchas gracias me fue de mucha utilidad. Siga asi.

  • thanks dude =)

  • Pingback: Sublime Text 2 介绍 | 东东东()

  • kris

    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.


  • Andres

    Great post… thanks man!

  • Pingback: How do I install Sublime Text 2 in Ubuntu 12.04? | A Quest for Technical Expertise()

  • Pingback: Create a Sidebar launcher for Sublime Text 2 in Ubuntu Unity | saintsjd()

  • machv5

    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.

  • karliic

    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

      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!

  • Jim Barrett

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

  • machv5

    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.

    • machv5

      Erm sorry about my shoddy grammar and lack of paragraphs I will pay more attention to editing in the future.

  • Flonka

    Awesome tutorial, worked like a charm! Thanks!

  • Bug

    Perfect! Works like a charm!

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


  • Pingback: Vim和Emacs的替代工具:Sublime Text | EvilCode 邪恶代码()

  • Lionel

    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.

    • Lionel

      When I say the method above I mean the method explained in the article above not the PPA method on this post. 🙂

  • Sasha

    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.


  • Pingback: Install Package Control in Sublime Text 2 |

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

    • /lib -> kernel class
      /usr/lib -> system class
      /usr/local/lib -> user class

  • Matt Lemmon

    Thank you!!! Very helpful!

  • Sinan Erdem

    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.

  • che

    Thanks for this tutorial. It is very userful.

  • deepak

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

  • Pingback: Instalar Sublime Text no Ubuntu 12.04 | Desenvolvimento Livre()

  • shallker

    Before get yourself into trouble, go read this page

  • Pingback: Emergency List « Il Rifugio dei Corsari()

  • Pingback: ほたるのゆき » Linux 設定 Sublime Text2()

  • WEL

    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!

  • Jeffrey Thompson

    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

  • Jeffrey Thompson

    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

  • mustafa

    it works, thanks a lot

  • Pingback: Important Links Regarding Ruby – Jyothi()

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

  • Nael

    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?

  • David

    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

      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.

  • edward

    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?

    • edward

      I can’t believe this system let me post this dumb comment and it put my picture there too. This really sucks.

      • edward

        cd sublime/ text / 2 ??? really? with the back slashes?

        • edward

          I’ll try again tomorrow to install a text editor on my &$^#^#&@ virtual piece of crap unix box. Was unable to acccomplish it today. But thanks for the tutorial.

  • Majda

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

  • Pingback: Ubuntu'da Sublime Text 2 Kullanmak | Hakan Aktaş()

  • Pingback: Sublime Text 2 | HtutMyat()

  • Hi,

    Very helpful! Worked first time.


  • someone else

    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.

  • John Buckley

    Thank you very much!

  • 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.)


  • Elly

    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.

  • Thank you, this helped me alot

  • moenet

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

    • xeranas

      You can create simbolic link manualy:
      sudo ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/local/bin/sublime

  • Pingback: ubuntu 12.04 完美安装sublime text2 【整理】 | web前端,杭州小白的个人博客,小白的个人博客()

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

  • Jerry

    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. 🙂

  • Grim

    Great tutorial, thanks for the assistance!

  • bounasser

    thx it works fine 😉

  • Pingback: How to install Sublime Text 2 on Ubuntu 12.04 (Unity) | Technically Wrong -()

  • Thank you very much!!!

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

  • Djonatas Tenfen

    Thanks Very good post 😀

  • Pingback: Ubuntu’ya Sublime Text 2 Kurmak | Murat Yüksel()

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

  • Girogio

    Thanks so much; very useful for Linux noobs! 🙂

  • Renatiux

    Great! Thanks for the detailed info.

  • Thanks for this tip!

  • Dave

    Thanks a lot, this was extremely useful!

  • aza

    Thank You!

  • Saul Spatz

    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

      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.

      • Are you sure the path to your Sublime Text icon is correct ?

  • Saul Spatz

    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

  • VioletZun

    Thanks! This is totally awesome.

  • Kevin

    That worked perfectly! Thank you!

  • Kevin

    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!

  • Kevin

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

  • honesta

    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?

  • Kevin

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

    • honesta

      that didn’t work. What I did was to clear all items in ‘open recents’. that way now I have a clean ST every time I click the icon. Though now is another problem, that it doesn’t open the last opened file from the previous time. It is always blank.

  • CAV

    Thank you. Extremely helpful and straightforward =D

  • JD

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

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

    • Oia,, I’ve added your tutorial to my tumblr. Could i ? 🙂

  • Thank you very for the solution 🙂

  • Pingback: Sublime Text 2 on Ubuntu 12.10 | tobyw4n()

  • Denis

    This was very helpful. You are life savior. Thanks

  • Jhonny

    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!

  • Jhonny

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


  • Kevin

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

  • Jake

    This way of doing things is utterly and completely wrong.

    For the correct method see this article:

  • Pingback: Instalar Sublime Text 2 en Ubuntu 12.04 utilizando Unity | Junior Developer [the blog]()

  • Thanks

    Thanks for the post! It’s very useful

  • Max

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

  • Pingback: 在ubuntu12.04(Unity桌面)中安装Sublime Text 2 | Zhoutall()

  • Pankaj

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

    • Jake

      You can… In fact I strongly suggest you un-do everything the above tutorial told you to do and follow these instructions:

      • Thanks for this warning and link!
        I had the exact same problem. My session was only being saved when run as sudo, and I wasn’t aware that modifying the /usr directory was inadvisable.

  • Pingback: Приложения по умолчанию в Ubuntu | nadyarnv()

  • you made my day! thanks a lot for sharing!

  • Gene

    Thanks, very helpful and informative

    • Gene

      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.

  • Nice One – It worked

  • Clap – clap – clap – clap.

    Thank you!

  • Pingback: How to install Sublime Text 2 On Ubuntu 12.04 Unity | aginanjarm()

  • Thanks alot for this!

  • Arjan

    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.

  • Nick

    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,


  • Nick


    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?

  • wil this installation works for 32 bit ubuntu

  • will this works for 32 bit ubuntu

  • Nick

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

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

  • Nick

    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.

  • noob

    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

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

  • Pingback: Установка Sublime Text 2 в Ubuntu Linux | zlovolsky blog()

  • Pingback: A long weekend with Ubuntu - Colorblind Programming()

  • Pingback: SublimeText، ادیتوری که عاشقش میشی | اشکوب()

  • Nick


    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?



  • Santosh

    Thanks! Very useful.

  • Jashwant

    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

  • Pingback: Sexy code snippet management? I take this once please! | GeneralCarto()

  • Great stuff broda .. Thanks for your help

  • Alonso


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

    • andy

      You can try “subl” instead of sublime, it is the command in my shell.

  • Here is even simpler way –

    • Haha, nice. Thank you Jaimin 😀

  • 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.


  • Pingback: Menjadikan Sublime Text Sebagai Default Text Editor Di Ubuntu | MusaAmin.Web.ID()

  • Steven Van Selus

    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.

  • Ryan

    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:

  • Orestarod

    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?

    • add an ampersand after the command.

      #sublime &

      • 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

  • Pingback: Installing and Using Sublime Text In Ubuntu | OMG! Ubuntu!()

  • Pingback: Cómo Instalar Sublime Text 2 en Ubuntu Unity | Otro Espacio Web Blog()

  • Ron Phillips

    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?

  • Pingback: How to associate file types with Sublime Text 2? | -()

  • Pingback: How to associate file types with Sublime Text 2? | Ubuntu InfoUbuntu Info()

  • Thanks!
    Simple to follow and worked perfectly

  • Pingback: Bash Script for Installing Sublime Text 2 on Linux | | blog()

  • 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.

  • Pingback: معرفی نرم افزار :‌ لذت تایپ با Sublime Text | Blog EmergencyTech()

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

  • Pingback: How to add Sublime text to dash board | -()

  • Pingback: How to add Sublime text to dash board | Ubuntu InfoUbuntu Info()

  • Phage

    Any one please how to delete it.

  • Pingback: How to remove Sublime from Ubuntu 12.04 | -()

  • Pingback: How to remove Sublime from Ubuntu 12.04 | Ubuntu InfoUbuntu Info()

  • ednilson

    Very good!
    Thank you Jevin!

  • Ani-Gizzle

    Meticulously written and very resourceful. Thank you!

  • Cybe

    Great tutorial man! Will bookmark this.

  • 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

  • This is totally awesome! Works fine with my Ubuntu 12.04

  • Julius G

    Thanks for this. Works for me

  • Pingback: How do I install Sublime Text 2? | Ubuntu InfoUbuntu Info()

  • Dank

    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?

  • Pingback: Run program in terminal | Ubuntu InfoUbuntu Info()

  • Pingback: Run Galfit in terminal | James n Sheri.comJames n

  • Mike Herrera

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

  • Thanks! That worked perfectly.

  • Yavuz




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

  • Sachith

    just do this,

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

  • 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!

  • Thanks! It works for me. 🙂

  • Pingback: install sublime 2 on ubuntu 12.04 | mostran wiki()

  • Cyb3

    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

      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

        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

          Looks like you might need to run that second command

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


          • Cyb3

            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?

  • Pingback: How to install SublimeText 2 on Ubuntu | gabconcepcion()

  • Thanks man, works like charm 😉

  • Anon

    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!

  • Alex

    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!!

  • Denn

    Thank you! Detailed and very helpful!

  • Wolfy

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

  • Pingback: การลง Sublime Text 2 บน Ubuntu 12.04 | Priesdelly's Blog()

  • 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.

  • Shaifali Agrawal


  • Thanks man, very useful, worked out of the box

  • Pingback: Mulog | Ubuntu下安装SublimeText2()

  • Pingback: 11 Python IDEs for Linux()

  • Pingback: How do I install Sublime Text 2? | Ask Ubuntu()

  • Pierre

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

  • Jose Correa

    Thanks! It happens very well!

  • Pingback: Sublime Text 2 on Ubuntu | Michał Urbański Blog()

  • Pingback: Undoing Sublime Installation | Ubuntu InfoUbuntu Info()

  • Pingback: การลง Sublime Text 2 บน Ubuntu 12.04 | Heartdisc()

  • Pingback: finally installed sublime text | Nothing Useful Here()

  • Pingback: Installer un Textmate like | Mac2linux()

  • Pingback: Web Development Tools for Linux & How to Install Them - News Press()

  • Pingback: Web Development Tools for Linux & How to Install Them | Linux()

  • Pingback: Manually Installing Sublime Text 2 On Ubuntu | Danny Tsang()

  • Pingback: Sublime Text — 跨平台的專業文字編輯器 | G. T. Wang()

  • Pingback: How to associate file types with Sublime Text 2? - TecHub()

  • Pingback: How to remove Sublime installed using the website instructions? - TecHub()

  • Pingback: Sublime | SZTR()

  • Pingback: Ubuntu:How do I install Sublime Text 2/3? – Ubuntu Linux Questions()

  • Pingback: Ubuntu:How to associate file types with Sublime Text 2? – Ubuntu Linux Questions()

  • You could definitely see your skills in the work you write.
    The sector hopes for even more passionate writers such as you who aren’t afraid
    to say how they believe. All the time follow your

  • Pingback: How do I install Sublime Text 2/3? - ubuntutextbook()

  • Pingback: Linux: Installing Sublime Text Editor – Doctor Henry Blog()

  • Pingback: Make Install Error 2 Ubuntu()

Twitter Profile Picture

Jevin Sew

1645 Tweets
274 Following