|
NAMErcm —
dotfile management
SYNOPSIS
DESCRIPTIONThe 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 DIRECTORIESThis 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.
COMMON PROBLEM: EXISTING INSTALL SCRIPTSMany existing dotfile directories have scripts named install or Makefile in the 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 DIRECTORYA 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 ~/.dotfilesThis 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 COMMON PROBLEM: CONFIGURATION FILES/DIRECTORIES WITHOUT DOTSBy default, the rcm suite will prefix every file and directory it manages with a dot. If that is not desired, for example in the case of ~/bin or ~/texmf, you can add that file or directory toUNDOTTED in
rcrc(5) or
use the -U option. For example:
mkrc -U bin QUICK START FOR EMPTY DOTFILES DIRECTORIESThis section is for those who do not have an existing dotfiles directory and whose dotfiles are standard.
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 DOTFILESThis 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.
MULTIPLE DOTFILE DIRECTORIESAnother 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 DOTFILESYou 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 mkrc -B eggplant .rcrc macOS users should see the BUGS section for more details. STANDALONE INSTALLATION SCRIPTThe rcup(1) tool can be used to generate a portable shell script. Instead of running a command such as ln(1) or rm(1), it will print the command tostdout . This is controlled
with the -g flag. Note that this will generate a
script to create an exact replica of the synchronization, including tags,
host-specific files, and dotfiles directories.
env RCRC=/dev/null rcup -B 0 -g >
install.sh Using the above command, you can now run
RATIONALEThe 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 ~/.rcrcSEE ALSOlsrc(1), mkrc(1), rcdn(1), rcup(1), rcrc(5)AUTHORSrcm is maintained by Mike Burns
<mburns@thoughtbot.com>
and thoughtbot
BUGSFor macOS 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 macOS, the hostname is unpredictable, and can even change as part of the DHCP handshake.CONTRIBUTORSAlan Yee <alyee@ucsd.edu> Andrei Dziahel <develop7@develop7.info> Anton Ilin <anton@ilin.dn.ua> Ben Stephens <BKStephens@outlook.com> Ben Turrubiates <ben@turrubiat.es> Blake Williams <blake@blakewilliams.me> Caleb Land <caleb@land.fm> Carl van Tonder <carl@supervacuo.com> Casey Rodarmor <casey@rodarmor.com> Christian Höltje <docwhat@gerf.org> Christian Höltje <docwhat@gerf.org> Christopher Koch <ckoch@cs.nmt.edu> Dan Croak <dan@thoughtbot.com> Daniel Watson <dwatson@thig.com> David Alexander <davidpaulalexander@gmail.com> Devraj Mehta <devm33@gmail.com> Edd Salkield <edd@salkield.uk> Eric Collins <eric@tabfugni.cc> Florian Tham <fgtham@gmail.com> George Brocklehurst <george@thoughtbot.com> Graham Bennett <graham@simulcra.org> Jarkko Kniivilä <jkniiv@gmail.com> Jason Daniel Augustine Gilliland <jdagilliland@gmail.com> Javier López <linux.kitten@gmail.com> Joe Ferris <jferris@thoughtbot.com> John Axel Eriksson <john@insane.se> Jordan Eldredge <jordaneldredge@gmail.com> Leonardo Brondani Schenkel <leonardo@schenkel.net> Martin Frost <frost@ceri.se> Mat M <matm@gmx.fr> Matthew Horan <matt@matthoran.com> Melissa Xie <melissa@thoughtbot.com> Michael Reed <supertron421@gmail.com> Mike Burns <mburns@thoughtbot.com> Mike Burns and Eric Collins <mburns@thoughtbot.com> Nick Novitski <github@nicknovitski.com> Pablo Olmos de Aguilera Corradini <pablo@glatelier.org> Patrick Brisbin <pat@thoughtbot.com> Rafael Santos <formigarafa@gmail.com> Rebecca Meritz <rebecca@meritz.com> Roberto Pedroso <roberto@rpedroso.com> Scott Stevenson <scott@stevenson.io> Stephen <stephengroat@users.noreply.github.com> Teo Ljungberg <teo@teoljungberg.com> Tyson Gach <tyson@tysongach.com> Vlad GURDIGA <gurdiga@gmail.com> Yota Toyama <raviqqe@gmail.com> Zach Latta <zach@zachlatta.com> kajisha <kajisha@gmail.com> maxice8 <thinkabit.ukim@gmail.com> subpop <subpop@users.noreply.github.com> wplatter-cb <39812934+wplatter-cb@users.noreply.github.com>
Visit the GSP FreeBSD Man Page Interface. |