Skip to content

Instantly share code, notes, and snippets.

@simonewebdesign
Last active March 11, 2024 12:23
Show Gist options
  • Save simonewebdesign/8507139 to your computer and use it in GitHub Desktop.
Save simonewebdesign/8507139 to your computer and use it in GitHub Desktop.
Install Sublime Text 3 on Linux via POSIX shell script - http://simonewebdesign.it/install-sublime-text-3-on-linux/
#!/bin/sh
# Sublime Text 3 Install (last update: Monday 13 March 2017)
#
# No need to download this script, just run it on your terminal:
#
# curl -L git.io/sublimetext | sh
# Detect the architecture
if [[ "$(uname -m)" = "x86_64" ]]; then
ARCHITECTURE="x64"
else
ARCHITECTURE="x32"
fi
# Fetch the latest build version number (thanks daveol)
BUILD=$(echo $(curl http://www.sublimetext.com/3) | sed -rn "s#.*The latest build is ([0-9]+)..*#\1#p")
URL="https://download.sublimetext.com/sublime_text_3_build_{$BUILD}_{$ARCHITECTURE}.tar.bz2"
INSTALLATION_DIR="/opt/sublime_text"
# Download the tarball, unpack and install
curl -o $HOME/st3.tar.bz2 $URL
if tar -xf $HOME/st3.tar.bz2 --directory=$HOME; then
sudo mv $HOME/sublime_text_3 $INSTALLATION_DIR
sudo ln -s $INSTALLATION_DIR/sublime_text /usr/local/bin/subl
fi
rm $HOME/st3.tar.bz2
# Add to applications list and set icon
sed 's/Icon=sublime-text/Icon=\/opt\/sublime_text\/Icon\/128x128\/sublime-text.png/g' > $HOME/.local/share/applications/sublime_text.desktop
echo '
Sublime Text 3 installed successfully!
Run with: subl
'
@simonewebdesign
Copy link
Author

Nice, finally, thanks for pointing that out.

For the migration, unless you have fancy stuff, all you need to do is save your user configuration somewhere (e.g. one convention is to have a dotfiles repository, but you might as well just make a gist or keep it somewhere else), also keep note of your plugins and themes. When you're ready just do rm -rf $(which subl).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment