raphting.dev

Package manager for dotfiles

There’s a multitude of dotfile manager helpers out there. For clarification: A dotfile is a configuration file typically used in UNIX operating systems to configure various software applications. They are prefixed with a dot “.” so that they are hidden by default.

Gnu Stow, a tool to manage dotfiles, has a history dating back to the year 1993.

What it does

Stow is technically a file link manager. Many file systems offer to link a filename to the contents of another file. Stow by default works with the parent directory. Wherever you store your stow folder, by default stow will create file links in the parent directory.

How to use it

This is how my directory structure looks like. I keep this structure under $HOME/.dotfiles.

.
├── .git
│   ├── ...
├── .stowrc
├── Readme.md
├── git
│   └── dot-gitconfig
├── tmux
│   └── dot-tmux.conf
├── vim
│   └── dot-vimrc
└── zsh
    └── dot-zshrc

Going from top down, there is a .git folder for keeping track of my dotfiles with git. The .stowrc file is a configuration file for stow itself. Mine contains --dotfile. This configuration option will replace files prefixed with dot- with a .. That way you can work with non-hidden files and still have them hidden after you install the dotfile package.

To enable a package, type stow <package>. For example stow vim will link a file .vimrc from the parent directory ( in my case my home directory), to the file vim/dot-vimrc.

To remove a package, type stow -D <package>.

By Raphael Sprenger