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

The issue regarding the package manager has been fixed. If anyone has encountered any other issues at all just let me know.

@djx2unv
Copy link

djx2unv commented Mar 5, 2016

Worked out, Fedora 23. Thanks a lot, bro!! Best regards!

@Koisell
Copy link

Koisell commented Apr 21, 2016

I have the 3083 built and I want to update it without losing any package I installed through Package Control. How can I do?

@MaximusSeniorem
Copy link

MaximusSeniorem commented May 4, 2016

I had to update https://sublime.wbond.net/ to https://packagecontrol.io
Ortherwise curl launch an SSL error

also change /bin/subl to /usr/local/bin/subl (otherwise I get an error message with the subl command... RHEL specific I guess)

Lastly create "Installed Package" sub folder before moving package control file there.

(RHEL 6)

@MaximusSeniorem
Copy link

@Koiseli:
I think your packages are installed in $HOME/.conf/Installed \Packages or Packages
If not, you should move those from the /opt/sublime-text/Installed \Packages there and put a symbolic link in place

@David-Else
Copy link

hi, is this confirmed working in fedora24? thanks!

@hebertjulio
Copy link

Yes! I am using Fedora 24 and it work fine for me. 👍 Great job!

@rahulchhangani
Copy link

Getting Error
/usr/local/bin/subl: line 2: [: ==: unary operator expected

@t-bltg
Copy link

t-bltg commented Nov 5, 2016

Very convenient script, thanks !

I just had to change one line to make it work on FEDORA 24:

$ curl -LO git.io/sublimetext
$ sed -i '\,sudo mv $HOME/Package,i sudo mkdir -p "$INSTALLATION_DIR/Installed Packages"' sublimetext
$ sh sublimetext

@praneethng
Copy link

HI neok-m4700 can you give me the script you have used for fedora 24?
I was using sublime-text2 on fedora 22 after upgrading to fedora 24 i am not able to open sublimet-text2

@shanginn
Copy link

@praneethng here you go. I made 2 changes at lines #35 and #36
https://gist.github.com/shanginn/046eb3dfdd419a9aae3e2c078c7569a3
But I'm not really sure does it work or not.

@simonewebdesign
Copy link
Author

I've updated the script to no longer install Package Control, as it can now be installed very easily by pressing Ctrl+Shift+P and typing "package control".

@AdmiralAsshat
Copy link

AdmiralAsshat commented May 28, 2017

Sublime Text appears to have an official repo for installing on Fedora now. Does this still need to exist? It has served me well, but at this point I just want migration/removal instructions so that I can safely switch to the official repo.

@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