Install Sublime text editor

efthialex
  11 years ago
  31

What is Sublime Text?

Sublime Text is a sophisticated text editor for code, html and prose. The program was originally desighned as a feature-rich extension of Vim. It's the best editor for HTML5 and CSS3 developers (It doesn't need extra plugins like other text editors).

 

 

About this tutorial

This tutorial will explain how to install Sublime Text and how to make it a native application.


 

 

Installation process

First Method

 

Open a terminal with Ctrl+Alt+T and type:

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

sudo apt-get update

 

Optional: remove any installed Sublime Text packages:

sudo apt-get --purge remove sublime-text*

 

Now to install Sublime Text, type the following:

sudo apt-get install sublime-text

 

 

Second Method

 

First you need to download Sublime for 32bit or 64bit system.

 

Once you download the file locate it and extract it. I assume that the downloaded file is located in /home/DownloadsOpen a terminal with Ctrl+Alt+T and type 

cd ~/Downloads (With this command we change the default directory "/" to "/Downloads") and then type

 

For 32bit version

tar -jxvf Sublime\ Text\ 2\ 2.0.1.tar.bz2 to extract the file.

 

For 64bit version

tar -jxvf Sublime\ Text\ 2\ 2.0.1\ x64.tar.bz2 to extract the file.

 

 

Once you extract the file type the following commands invidually:

sudo mv Sublime\ Text\ 2 sublime

sudo mv sublime /opt/

cd /opt

sudo chown -R root:root sublime

sudo chmod -R +r sublime

 

 

Now we need to create a Sublime Text executable in your path. To do this execute the following commands:

 

sudo touch /usr/bin/sublime_text

sudo chmod 775 /usr/bin/sublime_text

 

 

Now press Alt+F2 and type:

gksu gedit /usr/bin/sublime_text

 

 

and copy paste the below code:

 

#!/bin/sh
#export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export SUBLIME_HOME="/opt/sublime"

$SUBLIME_HOME/sublime_text "$*"

 

and save the file.

 

 

Next , to create a menu icon press Alt+F2 and type:

gksu gedit /usr/share/applications/sublime.desktop

 

 

and copy paste the below code:

 

[Desktop Entry]
Encoding=UTF-8
Name=Sublime Text
Comment=
Sublime Text 2
Exec=sublime_text
Icon=/opt/sublime/Icon/256x256/sublime_text.png
Terminal=false
Type=Application
Categories=GNOME;GTK;Utility;TextEditor;
StartupNotify=true

 

 

and finally save the file.

 

Finally to launch Sublime Text for the first time

Menu Accessories Sublime Text

 

 

 

Comments
tjancz 6 years ago

Awesome tutorial. Thank You


semiramida 8 years ago

greatinstruction, very indication for any newbie , tnx guys..... i like to after i learn more to be usefull like u... to make something for comunity but i have a lot to learn for me ..and is hard , nobody explain u need to base on tutorials video and sites like urs,tnx again


nguyenminhnhan91 9 years ago

Great instruction ever seen.
Note that you should choose icon of 48x48 size. I have tried larger size but the icon is not shown.


Ryuunosuke 10 years ago

Great tutorial! Works fine.


rodrigo_uruguay 10 years ago

Works like a charm!!! Thanks!!


efthialex 11 years ago

@daveman1010220

No, it won't update automatically.


efthialex 11 years ago

@p0rsche

Thanks for the hint!
I fixed the artcle.


p0rsche 11 years ago

There is some nice bug in command-line argument in file /usr/bin/sublime_text
If you'll try to open file with spaces like the default 'Untitled Document' sublime will open 2 tabs - one for 'Untitled' and another one for 'Document'.
To fix this, just place $* in quotes:
$SUBLIME_HOME/sublime_text "$*"
Now it will work as proper.


lynze 11 years ago

Works in Linux Mint 14 Cinnamon... Thanks!


lorena 12 years ago

hi! i'm new here! i tried every steps above but when i clicked the sublime on my linuxmint 13 menu, it doesn't work. nothing happened. please help me. i really want this sublime for my project. thanks!!


3xOSC 12 years ago

Here is the sequel that no one asked for if you want to learn how to set a default syntax for Sublime Text 2:

http://community.linuxmint.com/tutorial/view/1144

(shameless self promotion)


frank_iv 12 years ago

thanks for this!
Now I can use my portable programs in more comfortable way.


ivy_s 12 years ago

Great tutorial!


avgerinos 12 years ago

Nice tutorial! Sublime is very helpful for HTML5 and CSS development.