Syncing Atom Plugins and Themes Between Multiple Machines

One thing I love about Atom is how effortless it is to sync preferences between my work and personal Macs. If you’re logged into Atom’s website, you can simply star any plugin or theme to save it to your starred list. Here’s my list of starred plugins.

Now, if you have Atom installed, you should have access to the bundled apm cli command.

To list your starred plugins, in a terminal run:

apm stars --user <your_github_username>

To install your starred plugins, simply add --install to the end:

apm stars --user <your_github_username> --install

And if you love bash aliases as much as I do…

alias atom:stars='apm stars --user <your_github_username>'
alias atom:update='atom:stars --install'

Syncing Atom Settings

Syncing packages is only half the battle! What about all your settings and preferences?

I personally have a private dotfiles git repo that I use to sync all system preference related things between machines. The way Atom stores your settings actually makes it really easy to sync them directly with git.

Atom creates a directory inside your home directory ~/.atom. Everything we need is stored inside there. The first thing you’ll need is your own dotfiles repo which the below instructions assume you already have.

First, you’ll need to close Atom since we’ll be moving some things around. After Atom is closed, we are going to move the ~/.atom directory inside your dotfiles repo and then create a symlink to this new location.

mv ~/.atom <path_to_your_dotfiles_repo>
ln -s <path_to_your_dotfiles_repo>/.atom  ~/.atom

Now you can open Atom once again. The symlinked directory will allow Atom to operate normally, however, all preferences will now be saved directly inside <path_to_your_dotfiles_repo>/.atom instead. If you cd into your dotfiles repo and run git status, there’s a lot of junk you’ll see that we don’t want to save. To hide some of this stuff, we can create a .gitignore file inside your .atom directory.

touch <path_to_your_dotfiles_repo>/.atom/.gitignore

# Then, add these lines to your new .gitignore file

Now when you do git status, you’ll see only a few files: config.cson, .gitignore and maybe snippets.cson or keymap.cson if you’ve saved preferences for those. These are the files you will want to commit and push!

And that’s about it. Next time you switch to another machine with Atom installed, you can just pull your dotfiles repo, add the ~/.atom symlink, run atom:update, and be on your way.

Any questions or comments?
Tweet me @jakedeichert.

Like what I write about? Add my RSS Feed!