Want to see the full-length video right now for free?Sign In with GitHub for Free Access
All of the dotfiles are in
/Users/gabe/.dotfiles rather than in
Thus, none of the programs on the system can find the files (like
rcm will symlink those files from
You can find rcm installation instructions in the rcm README. If you're on OS X and you have Homebrew installed, you can do this:
$ brew install thoughtbot/formulae/rcm
rcm relies on a few commands to work its magic. The first one is
lsrc is just like
ls, but for your dotfiles (or "rc files"). It doesn't link
anything, so it's safe to run as many times as you want -- there are no side
lsrc prints out a huge amount of output by default, so let's see how
to read each line. Each line is split by a colon and has this format:
That line means "rcm would symlink
/Users/gabe/.dotfiles/ctags". (Remember, it's not actually symlinking anything
In the output, there are a lot of vim backup files that shouldn't be symlinked.
-x flag to ignore them:
lsrc -x backups
There's still a lot of output. Let's ignore some more things:
lsrc -x backups -x bundle -x undodir
By ignoring these directories that have thousands of files inside them,
finishes a lot faster. Now it's totally ignoring the
undodir directories too, though. I don't want to symlink the files inside
those directories, but I actually do want to symlink the directories themselves.
That way everything can find the backups by following
~/.vim/backups, but the
backup files will live in
~/.dotfiles/vim/backups, and rcm won't have to
symlink thousands of files. I can do that with
-S to symlink the directories
but nothing inside them:
lsrc -S backups -S bundle -S undodir
They were totally ignored before, but rcm will now symlink the directories and none of the files inside them. It's one symlink instead of thousands.
Now that we know exactly what's going to be symlinked, we can do the actual
rcup conveniently takes the same flags as
also use the
-v ("verbose") flag so that
rcup prints exactly what it's
$ rcup -v -S backups -S bundle -S undodir ... '/Users/gabe/.dotfiles/zsh/colors.zsh' -> '/Users/gabe/.zsh/colors.zsh' '/Users/gabe/.dotfiles/zshenv' -> '/Users/gabe/.zshenv' ...
Note that the
zshenv file in the
.dotfiles directory has no leading dot, but
rcup adds the leading dot for us to
.zshenv in the symlink. This makes it so
that the files you edit in
.dotfiles are regular non-hidden files, but the
symlinked files are still detected by Zsh, Vim, etc as dotfiles.
rcup will detect files that are already symlinked and identical and do
nothing. If the file is already there (for example, if you already have a
rcup will ask you if you want to overwrite it. This is great
because it means that
rcup by default is safe: you can run it and it won't
destroy any files that you may have forgotten to manage with rcm. It also saves
a little bit of time.
If, after running
rcup, you want to remove all of your files, or start over,
you can run
rcup's counterpart command
rcdn ("rc down").
$ rcdn -v removed '/Users/gabe/.agignore' not a symlink, skipping: /Users/gabe/.zsh/rails.zsh ...
rcdn is safe by default: if something isn't a symlink, it
won't remove it. When first starting with
rcm, you may run
quite a bit until you figure out exactly what what you need.
rcm allows you to use a tag system to split up your configuration using any
system you'd like. I use it to store e.g. all of the
tmux-related configuration (for Zsh and Vim) in one
place instead of split up across my
vim directories. It's very handy
for pointing new tmux users at one place and letting them copy it over to their
system. It also makes the dotfiles directory much more organized.
Each file in (e.g.)
tag-ruby will be symlinked as if
tag-ruby were in the
/Users/gabe/.dotfiles/tag-ruby/gemrc will be symlinked as
/Users/gabe/tag-ruby/.gemrc. This also means that
for example, the files in
tag-ruby/vim will be copied into
just like the files in the top-level
vim/ directory. This allows me to
split up my vim configuration across multiple tags.
rcm ignores tags by default unless we explicitly tell it to install files from
that tag. We can use the
-t flag to indicate which tags to symlink:
$ lsrc -t ruby
And we can use
rcup to symlink the files:
$ rcup -v -S backups -S bundle -S undodir -t ruby
If your dotfiles are public, you might want to put the specific
you run in a shell script so people don't have to guess at which flags they
should use. An even better idea is to use rcm's built-in configuration file,
Here's an rcrc that behaves exactly the same way as
rcup -S backups -S bundle -S undodir -t ruby:
SYMLINK_DIRS="backups bundle undodir" TAGS="ruby"
You can use
EXCLUDES to mimic the
I use these to avoid copying files that don't make sense as dotfiles, like the README for the repository, or the install script.
Before you run
rcrc isn't symlinked yet and so
rcup doesn't pick
up on it. In order to use it the first time, you can run
rcup like this:
rcup to look for the rcrc file in the current directory and fixes
the chicken-and-egg problem.
You can see Gabe's dotfiles at gabebw/dotfiles.
Plus, check out our Weekly Iteration on dotfiles.