← Back to Archives

Building a Unified, Cross-Platform Dotfiles Architecture

Originally published on LinkedIn

Disclaimer: If you do not know what .emacs, .bashrc, or .zshrc files are, you can safely skip this post!

I finally sat down and built a unified, cross-platform .dotfiles architecture to bridge my macOS machines and my Chromebooks (Linux, Crostini environments).

I used to manually copy configuration files between computers, and versioning my .dotfiles in git is a massive quality-of-life upgrade. The core advantages are seamless machine enrollment via git cloning and symlinks, instant rollbacks using git history, and maintaining a single source of truth across all devices.

Instead of juggling all that crap for different operating systems, my setup is now driven entirely by OS-aware routing blocks in a single repository. Here is how it works under the hood:

Shell Configuration: My .zshrc uses uname checks to dynamically export the correct environment variables, Homebrew paths for macOS, and package wrappers for Linux.

The crucial step to making this work is symlinking the versioned dotfiles into the canonical places on your machine. For example, where ~/.dotfiles/ is your local git repository, you simply run:

ln -s ~/.dotfiles/.zshrc ~/.zshrc

(Note: For more complex setups, tools like chezmoi.io act as a templating engine that handles this for you. It takes a compiled approach, which is a bit different from my choice of live, git-updated symlinks, but it is incredibly powerful).