Sublime Forum

Install sublime text3 without sudo

#1

I would like to install sublime text 3 on my account on a high performance computer. I don’t have root access permission so I can’t use sudo. I asked the administrator to install for me but got rejected. I was wondering if there is a work around.
Thanks.

0 Likes

#2

Maybe use a portable build? But I am not sure things about auto upgrade for a portable build.

0 Likes

#3

You’ll just have to download and extract the tarball with each release.

0 Likes

#4

What you want here is the tarball version of Sublime Text, which you can install anywhere you want without special privileges. There is a little bit of extra initial setup work that you need to perform, and you have to manually perform upgrades if/when you want them.

The steps below tell you how to perform an initial setup. When a new build is released (or whenever you want to manually upgrade), you just need to perform the first two steps again (while Sublime isn’t running) to get the latest version. Note that you may want to move the existing sublime_text_3 folder out of the way or remove it entirely instead of writing over it, just to ensure that no lingering traces of the previous version remain.

  1. Choose a location where you are going to install Sublime Text, and change to that directory (this example presumes ~/local, since that’s what I use):

     tmartin:dart:~> cd ~/local
    
  2. Download the latest version of Sublime Text:

     tmartin:dart:~/local> wget -q --trust-server-names https://download.sublimetext.com/latest/stable/linux/x64/bz2
     tmartin:dart:~/local> ls
     sublime_text_3_build_3200_x64.tar.bz2
    

    This download URL will always download the latest stable 64 bit Linux Development version. Replace stable with dev in order to get the latest development build. These URL’s redirect on the server to the appropriate local version. That tends to make wget name the file bz2 locally. Here I’m using --trust-server-names to get wget to use the file name from the redirection.

  3. Untar the tarball, which will give you a sublime_text_3 folder that contains the juicy Sublime Text goodness:

     tmartin:dart:~/local> tar -xjf sublime_text_3_build_3200_x64.tar.bz2 
     tmartin:dart:~/local> ls
     sublime_text_3/  sublime_text_3_build_3200_x64.tar.bz2
    
  4. Create a symlink from the binary so that you can launch Sublime from the terminal:

     tmartin:dart:~/local> ln -s ~/local/sublime_text_3/sublime_text ~/local/bin/subl
     tmartin:dart:~/local> subl --version
     Sublime Text Build 3202
    

    This step is optional if you don’t want to launch Sublime from the terminal. Note that you can use any name for the link you want, but most online instructions use subl for this. This also requires that you have a folder in your home directory that you’ve added to the path. I use ~/local/bin for that personally.

Presumably you want to also launch Sublime from an app menu/launcher/etc. How you set that up is distribution specific. The easiest thing to do is create your own application shortcut and point it at the sublime executable (in this example, that would be ~/local/sublime_text_3/sublime_text). The folder extracted above also contains an Icon folder that you can use to assign an icon.

If you want to get more involved, you can also manually install the icons and the desktop file so that whatever launcher you use will know about Sublime. This bit is more involved, but it may be needed for things like integration with your desktop environment for opening files with Sublime and such, if you need/want that sort of functionality.

To do this, you need to copy the icons from the Icon folder in the extracted directory above to ~/.local/share/icons/hicolor. Note however that the structure in the Icon folder is something like Icon/128x128/sublime-text.png but the structure that’s needed is hicolor/128x128/apps/sublime-text.png (i.e. don’t do a straight copy because you need that apps directory in there).

Additionally, the sublime_text.desktop file requires editing because it assumes the install location is in /opt and that the install folder is sublime_text. So for example you’d edit it to replace the path mentions from /opt/sublime_text/sublime_text to /home/youruser/local/sublime_text_3/sublime_text. Once you’ve done that, copy the file to ~/.local/share/applications.

Once you’ve installed the icons and the desktop file, update the desktop database and the icons should appear however installed applications generally appear in your launcher:

    tmartin:~/local> update-desktop-database ~/.local/share/applications/
4 Likes

How to use ST in Linux-like OS
#5

Thanks, It worked!

0 Likes