RCM(7) Miscellaneous Information Manual RCM(7)

NAME

rcmdotfile management

SYNOPSIS

lsrc

mkrc

rcdn

rcup

DESCRIPTION

The rcm suite of tools is for managing dotfiles directories. This is a directory containing all the .*rc files in your home directory (.zshrc, .vimrc, and so on). These files have gone by many names in history, such as “rc files” because they typically end in rc or “dotfiles” because they begin with a period.

This suite is useful for committing your rc files to a central repository to share, but it also scales to a more complex situation such as multiple source directories shared between computers with some host-specific or task-specific files.

This guide serves as a tutorial motivating the suite. For a list of quick reference documentation see the SEE ALSO section below.

QUICK START FOR EXISTING DOTFILES DIRECTORIES

This section is for those who already have an existing dotfiles directory; this directory is ~/.dotfiles; the directory only contains rc files; and these rc filenames do not begin with a period. See the caveats below if this is not you.
  1. Dryrun with lsrc(1). Look for anything unexpected in here, such as ~/.install or ~/.Makefile, or an empty list of dotfiles.

    lsrc
  2. Update any symlinks with rcup(1). This is likely to do nothing, since your dotfiles already exist.

    rcup -v
  3. When necessary, add new rc files with mkrc(1).

    mkrc ~/.tigrc

COMMON PROBLEM: EXISTING INSTALL SCRIPTS

Many existing dotfile directories have scripts named install or Makefile in the directory directory. This will cause a ~/.install or ~/.Makefile symlink to be created in your home directory. Use an exclusion pattern to ignore these.

rcup -x install -x Rakefile -x Makefile -x install.sh

COMMON PROBLEM: DOTTED FILENAMES IN DOTFILES DIRECTORY

A less common situation is for all the filenames in your dotfiles directory to be prefixed with a period. These files are skipped by the rcm suite, and thus would result in nothing happening. The only option in this case is to rename all the files, for example by using a shell command like the following.

find ~/.dotfiles -name '.*' -exec echo mv {} `echo {} | sed 's/.//'` ;

Note that this will break any existing symlinks. Those can be safely removed using the rcdn(1) command.

rcdn -v

COMMON PROBLEM: DOTFILES DIRECTORY NOT IN ~/.dotfiles

This all assumes that your dotfiles directory is ~/.dotfiles. If it is elsewhere and you do not want to move it you can use the -d DIR option to rcup(1) or modify DOTFILES_DIRS in rcrc(5).

rcup -d configs -v

QUICK START FOR EMPTY DOTFILES DIRECTORIES

This section is for those who do not have an existing dotfiles directory and whose dotfiles are standard.
  1. Add your rc files to a dotfiles directory with mkrc(1).

    mkrc .zshrc .gitconfig .tigrc
  2. Synchronize your home directory with rcup(1)

    rcup -v

This will give you a directory named ~/.dotfiles with your dotfiles in it. Your original dotfiles will be symlinks into this directory. For example, ~/.zshrc will be a symlink to ~/.dotfiles/zshrc.

TAGGED DOTFILES

This suite becomes more powerful if you share your dotfiles directory between computers, either because multiple people share the same directory or because you have multiple computers.

If you share the dotfiles directory between people, you may end up with some irrelevant or even incorrect rc files. For example, you may have a .zshrc while your other contributor has a .bashrc. This situation can be handled with tags.

  1. A tag is a directory under the dotfiles directory the starts with the letters tag-. We can handle the competing shell example by making a tag-zsh directory and moving the .zshrc file into it using mkrc(1) and passing the -t option.

    mkrc -t zsh .zshrc
  2. When updating with rcup(1) you can pass the -t option to include the tags you want. This can also be set in the rcrc(5) configuration file with the TAGS variable.

    rcup -t zsh

MULTIPLE DOTFILE DIRECTORIES

Another common situation is combining multiple dotfiles directories that people have shared with you. For this we have the -d flag or the DOTFILES_DIRS option in .rcrc.

The following rcup invocation will go in sequence through the three dotfiles directories, updating any symlinks as needed. Any overlapping rc files will use the first result, not the last; that is, .dotfiles/vimrc will take precedence over marriage-dotfiles/vimrc.

rcup -d .dotfiles -d marriage-dotfiles -d thoughtbot-dotfiles

An exclusion pattern can be tied to a specific dotfiles directory.

rcup -d .dotfiles -d work-dotfiles -x 'work-dotfiles:powrc'

HOST-SPECIFIC DOTFILES

You can also mark host-specific files. This will go by the hostname. The rcrc(5) configuration file is a popular candidate for a host-specific file, since the tags and dotfile directories listed in there are often specific to a single machine.

mkrc -o .rcrc

If your hostname is difficult to compute, or you otherwise want to use a different hostname, you can use the -B flag.

mkrc -B eggplant .rcrc

OS X users should see the BUGS section for more details.

RATIONALE

The rcm suite was built as an abstraction over the shell, Ruby, Python, and make scripts people were writing and sharing. It is intended to run on any unix system and support the range from simple to complex dotfile directories.

As such, this suite is useful as a common base. Through this we can share tools and develop this further as a first-class entity. It is also our hope that a common set of tools will encourage others to share their dotfiles, too.

FILES

~/.dotfiles ~/.rcrc

SEE ALSO

lsrc(1), mkrc(1), rcdn(1), rcup(1), rcrc(5)

AUTHORS

rcm is maintained by Mike Burns <mburns@thoughtbot.com> and thoughtbot

BUGS

For OS X systems, we strongly encourage the use of the HOSTNAME variable in your rcrc(5). We use the hostname(1) program to determine the unique identifier for the host. This program is not specified by POSIX and can vary by system. On OS X the hostname is unpredictable, and can even change as part of the DHCP handshake.

CONTRIBUTORS

Andrei Dziahel <develop7@develop7.info> Anton Ilin <anton@ilin.dn.ua> Caleb Land <caleb@land.fm> Christian Ho??ltje <docwhat@gerf.org> Dan Croak <dan@thoughtbot.com> Daniel Watson <dwatson@thig.com> George Brocklehurst <george@thoughtbot.com> Javier L??pez <linux.kitten@gmail.com> John Axel Eriksson <john@insane.se> Jordan Eldredge <jordaneldredge@gmail.com> Mike Burns <mburns@thoughtbot.com> Pablo Olmos de Aguilera Corradini <pablo@glatelier.org> Patrick Brisbin <pat@thoughtbot.com> Roberto Pedroso <roberto@rpedroso.com>
July 28, 2013 Linux 3.12-1-amd64