Common workflows for managing your dotfiles with ralph.
The typical ralph workflow is: edit your config or dotfiles, run ralph apply, and verify with ralph doctor.
edit config/dotfiles --> ralph apply --> ralph doctor
Install ralph, clone your dotfiles repo, point ralph at it, and apply.
# Install ralph
go install github.com/mad01/ralph/cmd/ralph@latest
# Clone your dotfiles repo
git clone https://github.com/you/dotfiles.git ~/.dotfiles
# Symlink the config (if your config.toml lives in the dotfiles repo)
mkdir -p ~/.config/ralph
ln -s ~/.dotfiles/config.toml ~/.config/ralph/config.toml
# Or run the interactive setup instead
ralph init
# Apply all configurations
ralph apply
# Sync and build managed packages (if any are configured)
ralph sync
ralph applyFiles managed via symlink update automatically when you edit the source in your dotfiles repo. Templates and copies require a re-apply.
# Edit a symlinked file -- changes take effect immediately
vim ~/.dotfiles/.bashrc
# Edit a template -- re-apply to regenerate
vim ~/.dotfiles/.gitconfig.tmpl
ralph apply- Copy (or move) the file into your dotfiles repo.
- Add an entry to
config.toml(or a recipe file). - Run
ralph apply.
# Move the file into your dotfiles repo
cp ~/.config/starship.toml ~/.dotfiles/starship.toml
# Add the entry to config.toml
cat >> ~/.config/ralph/config.toml << 'EOF'
[dotfiles.starship]
source = "starship.toml"
target = "~/.config/starship.toml"
EOF
# Apply
ralph applyPackage management is a two-step process: ralph sync pulls remote repos, and ralph apply rebuilds packages that have changed. See packages for full details.
# Sync remote packages then build
ralph sync && ralph apply
# Sync a single package
ralph sync --package=my-tool
# Force rebuild all packages
ralph apply --force
# Preview without making changes
ralph sync --dry-run
ralph apply --dry-runralph doctor verifies the full state of your setup: config validity, symlink integrity, directory existence, repository status, build state, package health, tool availability, and RC file sourcing.
ralph doctorAddress any issues it reports, then run ralph apply to fix what can be fixed automatically.
Use the hosts field to target items to specific machines. The same config works everywhere -- items without a hosts field apply on all hosts, and items with a hosts list apply only on matching hostnames.
[dotfiles.work-vpn]
source = "work/vpn.conf"
target = "~/.config/vpn.conf"
hosts = ["work-laptop"]
[dotfiles.bashrc]
source = ".bashrc"
target = "~/.bashrc"
# no hosts field = applies everywhereTo sync across machines, push your dotfiles repo and pull on the other side:
# On machine A
cd ~/.dotfiles && git add -A && git commit -m "update" && git push
# On machine B
cd ~/.dotfiles && git pull
ralph sync && ralph applyRecipes also support host filtering at the recipe level, which applies to all items in the recipe. See recipes for details.
When your config outgrows a single file, extract sections into recipe directories:
- Create recipe directories and move source files into them.
- Write
recipe.tomlfiles with the relevant entries. - Add
[recipe.legacy_paths]soralph migratecan fix existing symlinks. - Remove the migrated entries from
config.tomland add recipe references. - Preview and execute the migration.
ralph migrate --dry-run
ralph migrate
ralph apply| Task | Command |
|---|---|
| Apply configuration | ralph apply |
| Preview changes | ralph apply --dry-run |
| Sync remote packages | ralph sync |
| Sync one package | ralph sync --package=NAME |
| Sync and build | ralph sync && ralph apply |
| Force rebuild all packages | ralph apply --force |
| Check health | ralph doctor |
| List managed items | ralph list |
| List packages by source | ralph list --source=remote |
| Migrate symlinks | ralph migrate |
| Initialize config | ralph init |
| Show version | ralph version |
These flags work on all commands:
| Flag | Short | Description |
|---|---|---|
--dry-run |
-n |
Show what would happen without making changes |
--verbose |
-v |
Show all items in summary output |
--quiet |
-q |
Show only failures in summary output |