Yesterday, I walked through the process of sharing databases in Dropbox so it makes sense to follow that up with how to go about sharing Visual Studio Code settings in Dropbox.
That is if you use Visual Studio Code (and I’ve had some people ask Twitter how to do this).
As the same is in the previous post, the same disclaimer that I work on macOS. So this dictates the commands I use, how I create symbolic links, and how I go about sharing settings among machines.
Since this is following up a similar post, why not jump right in?
Sharing Visual Studio Code Settings
If you’re on a Mac, there are two important things to note:
- If you’ve installed Visual Studio Code, we’re going to be accessing the
Librarydirectory and this can, with some installations, be a directory that needs `sudo` permissions. Maybe not, maybe so. The examples that I give won’t include it. (Some of you will need to include it, though.)
- This assumes that you don’t have an odd setup where you’re storing your settings in a custom location. if that’s the case, then you’re on your own.
So with that in place, here’s what you need to do to go about sharing Visual Studio Code settings.
1. A Symbolic Link Refresher
If you didn’t read the previous post, that’s fine. But you’re still going to need to know what symbolic links are and how to use them since all of this work is going to be done in the Terminal.
In short, consider them shortcuts where a location on disk refers to another location on the disk. Applications will usually treat this all the same.
Ultimately, we want to create a symbolic link between our settings so that Visual Studio grabs them from Dropbox rather than its default location.
2. Visual Studio Code Settings
On macOS, the Visual Studio Code settings are in ~
/Library/Application Support/Code/User. This is the directory that we want to move to Dropbox and then sync among machines.
First, above all else, make a backup of this directory. This can be as simple as creating a copy of the directory with a different name or duplicating it and moving it elsewhere. It’s whatever works for you.
Next, create a directory in Dropbox where you’ll be storing the files. I use
/Apps/Code/User and then drop them all there.
This more or less mirrors how it was originally set up and keeps my shared settings in a directory that’s easy to follow.
3. Create the Symbolic Link
Next, open a Terminal session and enter the following command:
This will create a link between the
User directory where Visual Studio Code is used to finding its files but point it to the location in Dropbox.
4. Multiple Machines
Next, simply repeat all of the above for each of the machines you want to share information. For me, I have one machine in which I usually install all of my packages, keep settings, etc., so now it’s all writing to Dropbox so the linked machines will inherit these changes.
On Reloading Visual Studio Code
Make sure that all instances of Visual Studio are closed when you’re doing this. And when you revisit the machines with Visual Studio Code, remember to refresh them.