How To Install Sublime Text on Linux Mint 22
Sublime Text is a powerful and versatile text editor that has gained immense popularity among developers and programmers. Known for its speed, flexibility, and extensive feature set, Sublime Text is an excellent choice for those working on Linux Mint 22. In this comprehensive guide, we’ll walk you through the process of installing Sublime Text on your Linux Mint 22 system, exploring various methods and providing troubleshooting tips to ensure a smooth setup.
What is Sublime Text?
Sublime Text is a sophisticated text editor designed for code, markup, and prose. It offers a sleek interface combined with powerful editing capabilities, making it a favorite among developers across various platforms. Some key features that set Sublime Text apart include:
- Multiple selections for simultaneous editing
- Powerful package ecosystem for extending functionality
- Cross-platform compatibility (Linux, macOS, Windows)
- Highly customizable interface and settings
- Fast and responsive, even with large files
- Distraction-free writing mode
While Sublime Text is proprietary software, it offers an unlimited evaluation period, allowing users to try it out extensively before purchasing a license.
Prerequisites for Installation
Before we dive into the installation process, ensure that your Linux Mint 22 system meets the following requirements:
- A stable internet connection for downloading packages
- Administrative privileges (sudo access) on your system
- Terminal access
- Updated system packages (run
sudo apt update && sudo apt upgrade
before installation)
It’s also recommended to have at least 200MB of free disk space for the installation.
Installation Methods
There are several ways to install Sublime Text on Linux Mint 22. We’ll cover three primary methods: using the official APT repository, installing via Snap, and manual installation.
Method 1: Official APT Repository Installation
Installing Sublime Text through the official APT repository is the recommended method as it ensures you get the latest stable version directly from the developers.
Step 1: Add the GPG key
First, we need to add the Sublime Text GPG key to ensure the authenticity of the package. Open your terminal and run the following command:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/sublimehq-archive.gpg > /dev/null
Step 2: Add the Sublime Text repository
Next, we’ll add the official Sublime Text repository to our system. Run this command:
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
Step 3: Update package information
Update the package information to include the new repository:
sudo apt update
Step 4: Install Sublime Text
Finally, install Sublime Text with the following command:
sudo apt install sublime-text
After the installation completes, you can launch Sublime Text from the application menu or by typing subl
in the terminal.
Method 2: Snap Package Installation
Snap packages offer a universal installation method across different Linux distributions. While not officially maintained by Sublime Text developers, the Snap package is a convenient option for many users.
Step 1: Ensure Snap support is enabled
Linux Mint 22 comes with Snap support pre-installed, but if you’ve disabled it, you can re-enable it with:
sudo rm /etc/apt/preferences.d/nosnap.pref
sudo apt update
sudo apt install snapd
Step 2: Install Sublime Text via Snap
To install Sublime Text using Snap, run:
sudo snap install sublime-text --classic
The --classic
flag is necessary because Sublime Text requires full system access.
Method 3: Manual Installation
For users who prefer more control over the installation process, manual installation is an option. This method involves downloading the package directly from the Sublime Text website and installing it manually.
Step 1: Download the package
Visit the Sublime Text download page and select the appropriate package for your system architecture (64-bit or 32-bit).
Step 2: Extract the archive
Once downloaded, extract the archive using the following command (replace VERSION
and ARCHITECTURE
with the appropriate values):
tar xjf sublime_text_VERSION_ARCHITECTURE.tar.bz2
Step 3: Move Sublime Text to /opt
Move the extracted folder to the /opt
directory:
sudo mv sublime_text_VERSION /opt/sublime_text
Step 4: Create a symbolic link
Create a symbolic link to make Sublime Text accessible from the command line:
sudo ln -s /opt/sublime_text/sublime_text /usr/local/bin/subl
Step 5: Create a desktop entry
Create a desktop entry file to make Sublime Text appear in your application menu:
echo "[Desktop Entry]
Version=1.0
Type=Application
Name=Sublime Text
GenericName=Text Editor
Comment=Sophisticated text editor for code, markup and prose
Exec=/opt/sublime_text/sublime_text %F
Terminal=false
MimeType=text/plain;
Icon=/opt/sublime_text/Icon/128x128/sublime-text.png
Categories=TextEditor;Development;
StartupNotify=true
Actions=Window;Document;
[Desktop Action Window]
Name=New Window
Exec=/opt/sublime_text/sublime_text -n
[Desktop Action Document]
Name=New File
Exec=/opt/sublime_text/sublime_text --command new_file" | sudo tee /usr/share/applications/sublime_text.desktop
Post-Installation Setup
After successfully installing Sublime Text, there are a few steps you can take to optimize your experience:
1. Install Package Control
Package Control is an essential tool for managing Sublime Text packages. To install it, open Sublime Text and press Ctrl+`
to open the console. Then, paste the following Python code and press Enter:
import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
2. Configure User Settings
Customize Sublime Text to your liking by modifying the user settings. Go to “Preferences” > “Settings” and add your preferred settings to the right pane. For example:
{
"font_size": 12,
"theme": "Adaptive.sublime-theme",
"color_scheme": "Packages/Color Scheme - Default/Monokai.sublime-color-scheme",
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true
}
3. Install Essential Packages
Use Package Control to install useful packages. Press Ctrl+Shift+P
, type “Package Control: Install Package”, and search for packages like:
- Emmet (for HTML/CSS productivity)
- SublimeLinter (for code linting)
- GitGutter (for Git integration)
- A File Icon (for improved file icons)
Troubleshooting Common Issues
While installing Sublime Text on Linux Mint 22 is generally straightforward, you might encounter some issues. Here are solutions to common problems:
1. GPG Key Issues
If you encounter GPG key errors, try manually importing the key:
curl -fsSL https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
2. Repository Not Found
If the Sublime Text repository isn’t found, double-check that you’ve added it correctly to your sources list. You can manually edit the file:
sudo nano /etc/apt/sources.list.d/sublime-text.list
Ensure it contains the correct repository URL.
3. Dependency Issues
If you encounter dependency problems, try running:
sudo apt --fix-broken install
This command will attempt to resolve any dependency conflicts.
4. Snap Installation Fails
If the Snap installation fails, ensure that snapd is properly installed and that your system is up to date:
sudo apt update
sudo apt upgrade
sudo apt install snapd
Congratulations! You have successfully installed Sublime Text. Thanks for using this tutorial for installing the Sublime Text on your Linux Mint 22 system. For additional help or useful information, we recommend you check the official Sublime Text website.