MediumLayering zsh config: machine-local vs shared | by gengwg | Oct, 2026 | Medium
Sitemap
gengwg

gengwg

Member-only story

Layering zsh config: machine-local vs shared

3 min readOct 1, 2026

--

One shell config, several machines, and a handful of settings that genuinely cannot be the same on all of them. The fix is layering rather than branching: one shared config, plus a small untracked file per machine.

The problem

Most of a shell config is portable: aliases, keybindings, plugin list. A few things aren’t.

  • The terminal differs. One machine has a Nerd Font, another doesn’t. The same p10k config renders as icons on one and tofu boxes on the other.
  • Paths differ. A tool installed via snap on one box and manually on the other.
  • Context differs. Aliases that should point at a work directory are meaningless in a shell where that directory doesn’t exist.

Maintaining per-machine copies of the whole config is the obvious answer and the wrong one. They drift, and you find out months later when a fix you made on one machine was never on the other.

The shape

Three layers, most-shared first:

  • Shared config (zshrc, aliases.zsh, p10k.zsh). On every machine. Holds everything portable, which is the overwhelming majority.
  • Machine-local (~/.zshrc.local). Never shared. Holds display quirks, paths, and which context this machine is for.
  • Context ($WORK/work.zsh). Shared with that context's files. Holds things meaningful only inside one body of work.

--

--