Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I installed Sublime Text 2 on 12.04 as per this tutorial.

However I don't have adequate permissions when launching the program from the Unity launcher. For example I cannot install packages, or if I add a folder to the sidebar when I close Sublime and reopen, the folder is no longer listed. If I run sudo sublime in the terminal all changes remain after closing.

I've tried chown-ing the Sublime Text 2 folder in usr/lib sudo chown -R mylogin:mylogin /usr/lib/"Sublime Text 2" but this seemed to have no effect.

share|improve this question

9 Answers 9

up vote 447 down vote accepted

Install via the Package Manager(apt-get):

Simply add to your packages:

For Sublime-Text-2:

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

For Sublime-Text-3:

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

Install Manually via Terminal:

Download from the Sublime Site:


wget\ Text\ 2.0.2.tar.bz2
tar vxjf Sublime\ Text\ 2.0.2.tar.bz2


wget\ Text\ 2.0.2\ x64.tar.bz2
tar vxjf Sublime\ Text\ 2.0.2\ x64.tar.bz2

For Both:

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


Install Manually via Script:

Check out this nice script on Github("Install Sublime Text on Fedora.") that you can run, just make sure to edit the "*.tar.bz2" in the script to download the latest version of Sublime Text!

#!/usr/bin/env bash
# Usage: {script} [ OPTIONS ] TARGET BUILD
#   TARGET      Default target is "/usr/local".
#   BUILD       If not defined tries to get the build into the Sublime Text 3 website.
#   -h, --help  Displays this help message.
# Report bugs to Henrique Moody <>

set -e

if [[ "${1}" = '-h' ]] || [[ "${1}" = '--help' ]]; then
    sed -E 's/^#\s?(.*)/\1/g' "${0}" |
        sed -nE '/^Usage/,/^Report/p' |
        sed "s/{script}/$(basename "${0}")/g"

declare URL
declare URL_FORMAT=""
declare TARGET="${1:-/usr/local}"
declare BUILD="${2}"
declare BITS

if [[ -z "${BUILD}" ]]; then
        curl -Ls |
        grep '<h2>Build' |
        head -n1 |
        sed -E 's#<h2>Build ([0-9]+)</h2>#\1#g'

if [[ "$(uname -m)" = "x86_64" ]]; then

URL=$(printf "${URL_FORMAT}" "${BUILD}" "${BITS}")

read -p "Do you really want to install Sublime Text 3 (Build ${BUILD}, x${BITS}) on \"${TARGET}\"? [Y/n]: " CONFIRM
CONFIRM=$(echo "${CONFIRM}" | tr [a-z] [A-Z])
if [[ "${CONFIRM}" = 'N' ]] || [[ "${CONFIRM}" = 'NO' ]]; then
    echo "Aborted!"

echo "Downloading Sublime Text 3"
curl -L "${URL}" | tar -xjC ${TARGET}

echo "Creating shortcut file"
cat ${TARGET}/sublime_text_3/sublime_text.desktop |
    sed "s#/opt#${TARGET}#g" |
    cat > "/usr/share/applications/sublime_text.desktop"

echo "Creating binary file"
cat > ${TARGET}/bin/subl <<SCRIPT
if [ \${1} == \"--help\" ]; then
    ${TARGET}/sublime_text_3/sublime_text --help
    ${TARGET}/sublime_text_3/sublime_text \$@ > /dev/null 2>&1 &

echo "Finish!"


This helped me and I hope it helps everyone else as well!

share|improve this answer
how can I launch sublime text 2 via the terminal? – Vader Jan 25 '14 at 3:46
@Vader… – Jared Burrows Jan 25 '14 at 20:11
Thx. Worked perfectly in Ubuntu 14.04 to install sublime 3. – Marcin Feb 28 at 9:33
Also, to use sublime as your default text editor instead of gedit, you should edit: /usr/share/applications/defaults.list by putting subl instead gedit. – Boubakr NOUR Mar 9 at 19:53
worked perfectly in ubuntu 14.04 using the second method ppa:webupd8team/sublime-text-3 – suhail May 4 at 6:15

Basically, your problem is that you're using a wrong article :) If it was on an SE site I would down-vote it.

Manually copying stuff which does not come from Ubuntu repositories into /usr is WRONG. This directory is managed by Ubuntu's package manager and messing with it is going to cause you trouble at some point or another - for example, the next time you upgrade your system Sublime will likely be removed without a trace.

Running the program as root is even wronger, especially in the case of SublimeText which has its own package manager which basically downloads stuff from Internet and lets it run on your computer. A simple typo in a plugin could destroy all data on your machine.

A proper solution, if you want to install the program system-wide, would be to find/build a .deb file and install it - this way package manager would be aware of the package. Webupd8 maintains a PPA for SublimeText2, so you can just use that.

However, there's a much lazier solution which I am personally using - just unpack SublimeText somewhere in your home directory, create a bin directory in your home directory and symlink sublime_text executable into that directory:

mkdir ~/bin
ln -s ~/wherever/sublime/is/sublime_text ~/bin

After which you'll be able to run Sublime Text by typing sublime_text in the console, from any directory. This does not require root privileges at all and the editor runs just fine.

The article also does some shell integration, such as registering sublime_text as a default editor and adding an icon, and I was too lazy to do that - however, I'm sure that it can be done without messing with system-wide settings.

This does not explain, however, the problems with permissions you're having - SublimeText stores all its settings in your home folder anyway, so even if you installed it system-wide it should not have problems. What probably happened is that you started it the first time with superuser privileges (i.e. from the sudo shell), so the editor's config directory (in ~/.config/sublime-text-2) is owned by root now. You need to do something like

sudo chown -R yourusername:yourusername /home/yourusername/.config/sublime-text-2

to fix this.

share|improve this answer
Could you fully explain the bit about creating a bin directory and symlinking it? – hellocatfood Feb 5 at 17:45
@hellocatfood: I've expanded my answer a bit – Sergey Feb 5 at 21:14

Here is how to solve this.

1) undo all the steps in the linked webpage in reverse order.

1a) if you didn't save a copy of your original defaults.list then open a terminal and run

sudo cp /usr/share/applications/defaults.list /usr/share/applications/defaults.list.bak && cat /usr/share/applications/defaults.list.bak | sed "s/sublime\.desktop/gedit.desktop/g" | sudo tee /usr/share/applications/defaults.list

2) get the version of sublime you want and extract it to the current directory.

3) in bash cd to the directory where you extracted sublime

4) mv Sublime\ Text\ 2 ~/.local

4a) if you want to be able to run sublime from the command line then run mkdir -p ~/bin && ln -s ~/.local/Sublime\ Text\ 2/sublime_text ~/bin/sublime. The default .bashrc will add ~/bin to your $PATH the next time your shell launches.

5) Make a file called sublime.desktop in ~/.local/share/applications/ and paste the following inside.

[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=~/.local/Sublime\ Text\ 2/sublime_text
Icon=~/.local/Sublime Text 2/Icon/48x48/sublime_text.png

[NewWindow Shortcut Group]
Name=New Window
Exec=~/.local/Sublime\ Text\ 2/sublime_text -n

6) test -e ~/.local/share/applications/defaults.list -a 1$(grep -sc \[Default\ Applications\] ~/.local/share/applications/defaults.list) != 10 || echo "[Default Applications]" >> ~/.local/share/applications/defaults.list; grep gedit.desktop /usr/share/applications/defaults.list | sed "s/gedit\.desktop/sublime.desktop/g" >> ~/.local/share/applications/defaults.list

7) done.

It should now be installed locally in your home directory and you should have no more issues with permissions.

share|improve this answer
The OP would probably have to delete/chown ~/.config/sublime-text-2 directory as that's what is causing the problem. Anyway, thanks for the detailed instructions. – Sergey Aug 7 '12 at 2:07
Please make a new "How do I install Sublime" question with answer, it would be a nice contribution so that people can do it right instead of following blog posts we can't fix! – Jorge Castro Aug 7 '12 at 14:48
@Sergey Yeah that would probably also work. A big issue with the linked directions though is that they ask you to install something to your /usr/lib manually, which is never good. – Alex L. Aug 7 '12 at 14:49

I think @Alex L. is completely right. I recommend never editting your /usr fs, add-on commercial software should be installed in either /opt for multi-user or ~/opt for single user (see Linux Filesystem Hierarchy especially /opt and /home). Here are just a few more additions to make it really nice.

  1. You don't have to move your app to .local or /local; I usually just leave them in ~/opt (n.b.: the tilde is your home directory or $HOME).

    user@machine:~$ cd ~/Downloads
    user@machine:~/Downloads$ cd wget
    user@machine:~/Downloads$ cd ..
    user@machine:~$ tar -C ~/opt -xf "~/Downloads/Sublime Text 2"
  2. Make a symlink to sublime_text in ~/bin, but call it sublime; see step 4a in Alex L.'s answer above.

    user@machine:~$ ln -s ~/opt/Sublime\ Text\ 2/sublime_text ~/bin/sublime
  3. Same as Alex L.'s step 5, make a file called sublime.desktop in ~/.local/share/applications/ but add %f after sublime in the Exec field so that you can open it from Nautilus, as described in this post. Also don't escape spaces for the Icon field and use the full path, no tilde. Replace <user> with your username.

    [Desktop Entry]
    Name=Sublime Text 2
    GenericName=Text Editor
    Exec=/home/<user>/bin/sublime %f
    Icon=/home/<user>/Sublime Text 2/Icon/48x48/sublime_text.png
    [NewWindow Shortcut Group]
    Name=New Window
    Exec=/home/<user>/bin/sublime -n
  4. You shouldn't have to log off, but if it doesn't show up in your dash, right away maybe you do. Then look for a file to open in Nautilus, right-click and select Open With Other Applicaton ... then Show other applications button at the bottom, find Sublime Text 2 in the list, select it and hit Select. Your file should open in Sublime Text 2, and from now on for files of that type you will see Sublime Text 2 already listed as an option. You can also set it as the default from Nautilus by right-clicking, selecting Properties then Open With and finally Set as default button after highlighting Sublime Text 2. Of course you could have used Add to select Sublime Text 2 to open the file type from the Properties window as well.

share|improve this answer
Without the full path for the Exec key the desktop file will not work in all situations. (though it is true that it will work most of the time). – Alex L. Nov 13 '12 at 16:40
Thanks Alex L.! Very good to know! I'm super happy with my sublime-text-2 setup now, and so far everything is working great. Very disappointed that people are being misled by this post :(. However now it seems that there is a ppa provided by WebUpd8 that users can install via apt-get :). – Mark Mikofski Nov 13 '12 at 17:54

I recently made this for your convenience:

A Sublime Text 2 and Sublime Text 3 bash script installer. Just download one of the scripts, ST2 or ST2.

For ST2 is: st2install

Put ir in your home folder. Then form a terminal (and in the same home folder) run:

sudo bash st2install

That will take care of all.

You can upgrade with that very same script too, in case a new ST2 version pop out. Same apply for installing/upgrading ST3.

And both versions, using those installers, can live together without conflicts.

Hope it helps ;)

share|improve this answer

I had the same problem and followed the above provided solutions without success. What did it for me was the following solution:


    1)Close all of your sublime app instances
    2)Open up the sublime desktop file
    sudo gedit /usr/share/applications/sublime-text-2.desktop
    3)Edit the file by replacing Exec=/usr/bin/subl %F with Exec=env UBUNTU_MENUPROXY=0 /usr/bin/subl %F
    4)Delete sublime profile configuration folders
     rm -fR ~/.config/sublime-text-2
    5) Start sublime from the top menu or shortcut

share|improve this answer
While other answers are very interesting, this one really resolved the issue for me. – Ladislav Mrnka Apr 14 '14 at 13:04

You can also also download the Debian package for your particular architecture from the sublime website

and then run the following;

cd download_path
sudo dpkg -i package.deb

for example if my download for a 64 bit architecture is in the Downloads directory and is called sublime-text_build-3080_amd64.deb then I will run

cd ~/Downloads
sudo dpkg -i sublime-text_build-3080_amd64.deb

In my case it was sublime text 3, you can get for your sublime text 2 also

share|improve this answer

Maybe there has simply something gone wrong during the installation. I'm using Sublime Text 2 on 12.04 and it doesn't need sudo. I suggest you type sudo apt-get purge sublime-text in a terminal (depends on which version you've installed. Use the tab key after having typed the line until "subl" twice - each installed version will be displayed). This will completely remove the installation. After that, go to the homepage of sublime text and make sure you download the .deb package. Browse the package in Nautilus (home folder), right-click on the .deb-package and choose "open with Software Center". In the Software Center, click install and follow the instructions. After that you should be able to launch the application without sudo.

share|improve this answer
The instructions he followed don't use deb packages – Jorge Castro Aug 6 '12 at 21:03
Oops, right. I remembered it being that easy. – speter Aug 6 '12 at 21:23

Type the following commands in the terminal, for Sublime Text 2 :

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

For Sublime Text 3 :

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer
share|improve this answer

protected by heemayl Aug 4 at 18:15

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.