How to backup Sublime Text with Dropbox (i.e. when shit blows up)

Fuck me sideways I was totally screwed Wednesday morning when my Code Editor decided to shit the bed. I must have said everything in the book about Sublime Text 2 like “This piece of shit sucks” or “Support sucks monkey balls! I fucking hate you Sublime Text!” I mean I was soooooo frustrated. Basically I was freaking out and throwing up! So much so that I almost downloaded Text Mate for god sakes! Holy shit that was close. Well thankfully for all of you I’ve made a point to document my struggles and make life a bit easier in case of an attack by the package boogie monster.

Sublime Text 2 Biotch!

Black Curtain Lifted

First off let’s figure out where the fuck everything is shall we? A good idea is to know where Sublime Text likes to store stuff, but most importantly it’s nice to know where to nuke directories in case you need to do some bug hunting with something like Packages which can be a pain in the ass and a huge source of our troubles when it comes to Sublime Text.

Fig 1.1 | The location of Sublime Text Packages

As you can see in figure 1.1 we start to unlock the mystery that is Sublime Text. This is where Sublime puts things like Packages that you install to make your own version Hawt to Trawt. In my case, a package was effin’ up my shit so a good idea is to delete packages within this folder (making a backup of course incase the package in question is the wrong one) to narrow down where the hell shit is going wrong. You’ll notice there will be a few items in the Packages folder so look for the ones that you know you’ve installed yourself.

Fig 1.2 | Sublime Text Installed Packages

In my case Fig 1.2, you can see the packages I’ve installed highlighted. In order to track down bugs as I mentioned, this is where you would start. When I had the buggy bugs I actually nuked everything which was a total mistake on my part and why I’m passing this along to you the fellow reader. Delete your installed user packages one by one and test your ass off. You can always backup the packages you’ve installed by making a duplicate of that Package you think is giving you the heeby jeebies. You should also take note that I have my directories as symlinks to my Dropbox account which I will explain how to do shortly.

Proof Packages Can Go Wrong

As you can see in this message below sometimes packages can actually blow up your shit. Remember this stuff is third party folks. Download at will.

Package Control Messages
========================

SublimeLinter:
-------------

  SublimeLinter 1.7.2 changelog
  =============================
  
  CHANGES/FIXES
  -------------
  - Update JSHint to v2.1.8
  - Fixing compatibility regression with latest JSHint
  - Fixing compatibility regression with latest Pyflakes
  - Apologizing for hasty v1.7.1 release 😉
SideBarEnhancements Changelog:

	## Shorcuts collisioning with Sublime2's built-in shortcuts have been removed.

	If you miss these

		- Go to "Preferences" -> "Browse Packages" -> "User"
		- Open or create file "Default.sublime-keymap"

		- Add this content:

				, { "keys": ["ctrl+t"], "command": "side_bar_new_file2" },
				{ "keys": ["f2"], "command": "side_bar_rename" },
				{ "keys": ["ctrl+alt+f"], "command": "side_bar_find_files_path_containing" }


	## If you have problems configuring F12 key

		- https://github.com/titoBouzout/SideBarEnhancements#f12-key

Backup w/Dropbox

I actually thought this part was not as legit as I had hoped during my downtime, but turns out Dropbox is not the problem so it’s a good idea to back up your stuff with them especially if you wanna hop around from computer to computer and have your shit synced like a pro.

Dropbox Biotch!

$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/
grayghostvisuals ✭ GrayGhostVisualsMacBookAir.local  ~/Library/Application Support/Sublime Text 2
$ ln -s ~/Dropbox/Apps/Sublime\ Text\ 2/Installed\ Packages ./Installed\ Packages
grayghostvisuals ✭ GrayGhostVisualsMacBookAir.local  ~/Library/Application Support/Sublime Text 2
$ ln -s ~/Dropbox/Apps/Sublime\ Text\ 2/Packages ./Packages
grayghostvisuals ✭ GrayGhostVisualsMacBookAir.local  ~/Library/Application Support/Sublime Text 2
$ ln -s ~/Dropbox/Apps/Sublime\ Text\ 2/Pristine\ Packages ./Pristine\ Packages
Fig 1.3 | My Dropbox and Sublime Text Symlink Process

How does it work?

On OS X…

  1. First close Sublime Text 2
  2. In your Dropbox folder (usually it’s at “~/Dropbox/“), add a folder called “Sublime Text 2
  3. Go to your Sublime Text 2 settings (this is usually at “~/Library/Application\ Support/Sublime\ Text\ 2/“)
  4. Copy the following 3 folders (“Installed Packages”, “Packages”, “Pristine Packages”) into “~/Dropbox/Sublime\ Text\ 2/
  5. Rename the 3 original folders in “~/Library/Application\ Support/Sublime\ Text\ 2/” or delete them.
  6. Next go back to Terminal
  7. From the command line type the following (excluding the ($) of course)…
$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/ 
$ ln -s ~/Dropbox/Sublime\ Text\ 2/Installed\ Packages ./Installed\ Packages
$ ln -s ~/Dropbox/Sublime\ Text\ 2/Packages ./Packages
$ ln -s ~/Dropbox/Sublime\ Text\ 2/Pristine\ Packages ./Pristine\ Packages

Start Sublime Text 2 and you’ll be linked to Dropbox.
On your other devices do…

$ mv ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User /tmp
$ ln -s ~/Dropbox/Sublime\ Text\ 2/Packages/User ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User

You can also do this for your Sublime Text icon. This is key because I dislike the taste of the ST2 icon so I opt for another more flavorful designer to provide me with a super dope one.

$ cd /Applications/Sublime\ Text\ 2.app/Contents/Resources
$ rm Sublime\ Text\ 2.icns
$ ln -s ~/Dropbox/Sublime\ Text\ 2/icon/Sublime\ Text\ 2.icns /Applications/Sublime\ Text\ 2.app/Contents/Resources

And just like that Phil is your uncle. Got questions? Leave a comment or hit me up on twitter.

Resources

GrayGhost

Web Development & Design, Technical Writing, Interaction Design, Open Source Maker & Contributor. Helping Create A Better Web. http://grayghostvisuals.com.
  1. ❧ Dave shouted:
    2014/06/21 • 9:36 pm

    Have you ever used (would you recommend) wbond’s Package Control?

    1. Yes. Package Control is one of the top installs for Sublime users and very handy to have.

Leave a Reply

Your email address will not be published. Required fields are marked *

show formatting examples
<pre class="language-[markup | sass | css | php | javascript | ruby | clike | bash]"><code>
…code example goes here…
</code></pre>

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Comment Preview

  1. John Doe shouted this comment preview:
    2013/08/03