Now that beta version of Sublime Text 3 has become more and more stable, I am going to post an updated walk-thru for the new version, since the commands differ in a few places, and I have learned a few things in the intervening months (slowly – baby steps here . . .).

As noted in the previous article regarding Sublime Text 2, Sublime Text 3 is not currently part of the Synaptic Package Management system on Linux Mint (or Ubuntu). Therefore, there is no magical apt-get install command as you might use to install other software on your Linux system, so we have to do a little more work.

In this article we will look at two different methods to install Sublime Text on your Ubuntu or Mint machine. First, "The Hard Way" and second, "The Better/Easier Way." The hard way requires a little more work, but if you are new to Linux, you will learn more. The easier way is much faster, but hides most of what is going on behind the Personal Package Archive system.

You can manually download the latest build (Build 3059 as of this writing) of Sublime Text 3 for either 32 bit or 64 bit architectures from the Sublime Text 3 page, unpack, and locate in the directory of your choice. This can be done manually, or from the terminal as described below.

If you are less-than-familiar with the Bash command line, be sure to visit my previous posts. While these were originally part of a series on using Git for Windows developers, the basic Bash commands required for this install are clearly explained:

This method is described on the Sublime Text Site/Support/Linux/Installation page. Simply open a terminal in the directory you use for applications, and enter the following command (use the appropriate version for the architecture (23 or 64 bit) of your machine):

Note: As of this writing, Sublime Text 3 build 3059 is the most recent beta release. If the release is updated, the URL's in the links below will change, and you will need to copy the updated URL from the Sublime Text site.

Move Extracted Sublime Text 3 Files to Opt Directory:

Now that we have located the files in an appropriate directory, let's make a Bash script which will allow us to execute Sublime Text 3 with a simple command. To do this, we are going to stay in our terminal, and perform a very simple edit using vi.

First, change to the /opt/sublime_text_3/ directory:

Move into the Sublime Text 3 directory in /opt/

$ cd /opt/sublime_text_3

Next, open vi into a new file named subl3 (this is a convenient shortcut to use from the terminal):

Open Vi Into New File suble3:

$ vi subl3

If you are new to editing text from the terminal, don't panic, this is not too bad, and also is something you should learn how to do, if only for occasions like this). There are a few key things to know about vi:

vi opens in Command Mode – you cant type any text yet. To enter Insert Mode, type the asterisk character followed by capital I ( *I ). This will allow text entry on the current line.

To return to command mode, hit the <escape> key.

to save the current file, from command mode, type the Colon character, followed by lower-case w and lower case q, then hit enter ( :wq <enter> ).

Now, you should be looking at a blank screen in vi. Enter Insert Mode ( *I ) and type the following two lines:

Type Bash Script Into Vi that Creates an Alias for Sublime Text 3

#!/bin/sh
exec /opt/sublime_text_3/sublime_text "$@"

Then exit Insert Mode ( <esc> ) and save the file ( :qw ).

Congratulations. You have now created a Bash script. Now, let's make sure the access permissions on our script are appropriate. Set the access permissions as follows:

Set Access Permissions on new Bash Script:

$ sudo chmod 755 subl3

This allows anyone to read or execute the script, but only the owner can write to it.

Now, we need to move the script file to the /usr/bin/ directory, so that it can properly respond to Bash commands:

Move Script to Proper Directory:

$ sudo mv subl3 /usr/bin/

Now, having done all that, let's look at the easier way to accomplish all of the above steps.

Canonical, the company which supports Ubuntu, has created the Launchpad.net site which, among other things, hosts a repository for Personal Package Archives (PPA's). Here, individuals and teams can upload their own software and installation packages, and it is possible to find deployment packages for software that is not included in the Ubuntu or Linux Mint Synaptic Package Manager for your specific distribution. It is also possible to add the PPA to your Synaptic catalog, so that you can then run apt-get install, apt-get update and the like to keep your package up to date.

Or, at least as up to date as the package maintainer at Launchpad keeps theirs.

The WebUpd8team at Launchpad has created (among other things) a PPA for Sublime Text 3 (currently still in beta as of this writing). To add Sublime Text 3 to your Synaptic catalog, and install according to the install script published with the PPA, follow these steps:

Add the Sublime Text 3 Repository to your Synaptic Package Manager:

sudo add-apt-repository ppa:webupd8team/sublime-text-3

Update:

sudo apt-get update

Install Sublime Text:

sudo apt-get install sublime-text-installer

Next, check the usr/bin directory. You should see a file named subl. This is the alias you can use to invoke Sublime Text 3 from the command line, just like we created manually above.

There you have it. You can now use Sublime Text 3 from you command line. Also, you should see it available in your GUI in the applications menu.

This has been a long post about a relatively simple operation. My goal has been to explain the concepts as fully as possible, under the assumption that there are those out there, like myself, new enough to Linux to need the extra handholding.

In addition, if you first followed the manual instructions, you may have learned a few more of the basics in working with Linux (and vi).

Share

About the Author

My name is John Atten, and my username on many of my online accounts is xivSolutions. I am Fascinated by all things technology and software development. I work mostly with C#, Javascript/Node.js, Various flavors of databases, and anything else I find interesting. I am always looking for new information, and value your feedback (especially where I got something wrong!)