By josh / July 31, 2012

Cross-platform syncing for Sublime Text editor settings and plugins with Dropbox

Between my day job as an ASP.NET developer and my freelancing and writing, I bounce around among computers quite a bit. I currently split time among my MacBook Air and a Windows 7 PC, as well as various Linux and Windows virtual machines.

After setting up Sublime for the second or third time, I realized that I needed to automate the process of installing packages and tweaking configs.

Portable Installation

The Windows version of Sublime is available as a portable installation, which keeps all of the files Sublime needs in one place and doesn’t touch the rest of the system. This allows you to install it on a USB key and run it from any PC with the same exact configuration.

I use Dropbox for all of my important files, and portable apps sync via Dropbox just as brilliantly as every other type of file. I created a \Programs\Sublime folder in Dropbox and installed the portable version of Sublime there. My Sublime settings and plugins sync seamlessly between Windows PCs, and when I create a new virtual machine, I don’t even have to install Sublime.

The Mac version of Sublime, sadly, doesn’t support this. Mac OS X doesn’t have a concept of portable apps, and Sublime for Mac places all of its important files in the ~/Libary/Application Support/Sublime Text 2/ directory.

Mac Setup

The following bash script removes Sublime’s default settings and plugins directories and creates symbolic links to the folders used by the portable Windows version installed in the ~/Dropbox/Programs/Sublime/ directory:

cd ~/Library/Application\ Support/Sublime\ Text\ 2/ 
rm -rf ./Packages rm -rf ./Installed\ Packages 
rm -rf ./Pristine\ Packages 
ln -s ~/Dropbox/Programs/Sublime/Data/Packages ./Packages 
ln -s ~/Dropbox/Programs/Sublime/Data/Installed\ Packages ./Installed\ Packages 
ln -s ~/Dropbox/Programs/Sublime/Data/Pristine\ Packages ./Pristine\ Packages 

Alternate Windows Setup

To take this one step further, you could also consider doing a full installation of Sublime on your Windows PC and set up hard links to just the \Packages, Installed Packages and Pristine Packages folders in Dropbox using the mklink command.

To create the hard links, launch the Windows command prompt as an administrator, then execute the following commands:

cd "%PROGRAMFILES(x86)%\Sublime Text 2" 
mklink /D "Installed Packages" "%USERPROFILE%\Dropbox\Programs\Sublime\Installed Packages" 
mklink /D "Packages" "%USERPROFILE%\Dropbox\Programs\Packages" 
mklink /D "Pristine Packages" "%USERPROFILE%\Dropbox\Programs\Pristine Packages"

Note: If you’re running a 32-bit version of Windows, the initial cd command above will fail. Use cd "%PROGRAMFILES%\Sublime Text 2" instead.

Minor Issues

I’ve encountered two issues with syncing all of Sublime’s configuration files this way. The first issue pertained to syncing project and session files. I was trying to store project files in a central location in Dropbox, and I found that Sublime tended to use full paths instead of relative ones. I later realized that you’re supposed to keep projects in the root directory of the files they pertain to. So if you have a project called MyWebsite, it goes in the MyWebsite root directory. This allows you to check the Sublime .project file into your version control system and share it with other team members.

The other main issue related to font sizes. I use a larger font on my Windows PC because I tend to sit back from the screen a bit more than when I’m working on my MacBook. But Sublime doesn’t know that, and the font settings sync along with everything else.

An elegant solution to this problem is setting up host-specific settings that allow you to toggle between different profiles when you switch computers.

P.S. Do you love using Sublime to get more done? Sign up for the free Sublime Text Tips newsletter to get more tips every week. As a bonus, I’ll send you a 12-page guide to Sublime’s advanced editing features so you can start using Sublime more effectively–today.

About the author


Daniel Serodio - July 14, 2014

Your syntax highlighting has broken the code snippets

Tommy - July 19, 2014

I’ve run into the same issue trying to sync project files across multiple computers. I tried your suggestion of moving the .sublime-project file to the root of my project folder, but it still uses full paths. Is it your experience that storing the project file in the project folder changed the references be relative? (one note: I haven’t switched to Sublime 3 yet).

I tried editing the .sublime-project file to use a relative path (I just used “.”) and while it does work temporarily, it seems to revert back to an absolute path randomly and whenever another folder is added.

Pascal - August 30, 2014

Yeah, syncing all configuration files of ST is awesome but it would be next level if syncing of .sublime-project files works within Dropbox.
Please let me know if anything changes related to this topic!

Alex - October 20, 2014

The maker of Package Control said to me that this way of synching is wrong and might cause problems. I haven’t tried to sync with his method (synching only User directory), but I do have plugins crashed on Windows machine very regularly, and Wbond thinks that using the method above caused this. So be careful with it.

Click here to add a comment

Leave a comment: