GNU Stow and syncing dotfiles
Dotfiles and Organization: A Clean Setup on My New MacBook
After setting up my new MacBook with a focus on clean and minimal installations, I faced two main goals:
- Organize the dotfiles in my home directory.
- Create a GitHub repository to sync dotfiles across multiple computers.
Hereโs a concise overview of how I tackled these objectives using GNU Stow.
Using GNU Stow to Manage Dotfiles
I followed a great guide by Josean Martinez titled How To Easily Manage Your Dotfiles With GNU Stow.
GNU Stow is the key tool in this setup โ easily installable via Homebrew. It works by letting you keep your dotfiles organized in a dedicated directory (usually ~/dotfiles/
) and manage symbolic links in your home directory automatically.
For my setup, I organized configurations for:
- Aspell
- NeoVim
- iTerm2
This approach not only cleaned up my home directory but also enabled me to manage and sync my configuration files easily via GitHub.
Note: I wonโt cover the full setup here since Joseanโs blog post and accompanying YouTube video provide an excellent, step-by-step explanation.
Syncing Dotfiles with GitHub
Once the ~/dotfiles/
directory was well-structured and Stow had created the necessary symlinks, the final step was to push everything to a private GitHub repository.
A small hiccup was that I accidentally started the repository with a master
branch instead of main
. After a quick fix, I now have a clean dotfiles repo that stores all my configurations online, allowing me to push or pull changes and keep settings consistent across all my devices.
Hereโs a snapshot of my dotfiles repo directory structure for reference:
โโโ .aspell.en.prepl
โโโ .aspell.en.pws
โโโ .config
โย ย โโโ iterm2
โย ย โย ย โโโ AppSupport -> /Users/amos/Library/Application Support/iTerm2
โย ย โย ย โโโ sockets
โย ย โย ย โโโ secrets
โย ย โโโ nvim
โย ย โโโ .github
โย ย โย ย โโโ ISSUE_TEMPLATE
โย ย โย ย โย ย โโโ bug_report.md
โย ย โย ย โโโ pull_request_template.md
โย ย โย ย โโโ workflows
โย ย โย ย โโโ stylua.yml
โย ย โโโ .gitignore
โย ย โโโ .stylua.toml
โย ย โโโ doc
โย ย โย ย โโโ kickstart.txt
โย ย โย ย โโโ tags
โย ย โโโ init.lua
โย ย โโโ lazy-lock.json
โย ย โโโ lua
โย ย โย ย โโโ custom
โย ย โย ย โย ย โโโ core
โย ย โย ย โย ย โย ย โโโ init.lua
โย ย โย ย โย ย โย ย โโโ keymaps.lua
โย ย โย ย โย ย โย ย โโโ options.lua
โย ย โย ย โย ย โโโ plugins
โย ย โย ย โย ย โโโ alpha.lua
โย ย โย ย โย ย โโโ autopairs.lua
โย ย โย ย โย ย โโโ bufferline.lua
โย ย โย ย โย ย โโโ colorscheme.lua
โย ย โย ย โย ย โโโ conform.lua
โย ย โย ย โย ย โโโ guess-indent.lua
โย ย โย ย โย ย โโโ indent_line.lua
โย ย โย ย โย ย โโโ lazydev.lua
โย ย โย ย โย ย โโโ lazygit.lua
โย ย โย ย โย ย โโโ lspconfig.lua
โย ย โย ย โย ย โโโ luasnip.lua
โย ย โย ย โย ย โโโ mini.lua
โย ย โย ย โย ย โโโ nvim-cmp.lua
โย ย โย ย โย ย โโโ nvim-tree.lua
โย ย โย ย โย ย โโโ telescope.lua
โย ย โย ย โย ย โโโ todo-comments.lua
โย ย โย ย โย ย โโโ treesitter.lua
โย ย โย ย โย ย โโโ vimtex.lua
โย ย โย ย โย ย โโโ which-key.lua
โย ย โย ย โโโ kickstart
โย ย โย ย โโโ health.lua
โย ย โย ย โโโ info.lua
โย ย โย ย โโโ plugins
โย ย โย ย โโโ lint.lua
โย ย โโโ LuaSnip
โย ย โย ย โโโ all.lua
โย ย โโโ node_modules
โย ย โย ย โโโ .bin
โย ย โย ย โย ย โโโ node-gyp-build -> ../node-gyp-build/bin.js
โย ย โย ย โย ย โโโ node-gyp-build-optional -> ../node-gyp-build/optional.js
โย ย โย ย โย ย โโโ node-gyp-build-test -> ../node-gyp-build/build-test.js
โย ย โย ย โย ย โโโ tree-sitter -> ../tree-sitter-cli/cli.js
โย ย โย ย โโโ .package-lock.json
โย ย โย ย โโโ tree-sitter-cli
โย ย โย ย โโโ cli.js
โย ย โย ย โโโ dsl.d.ts
โย ย โย ย โโโ install.js
โย ย โย ย โโโ LICENSE
โย ย โย ย โโโ package.json
โย ย โย ย โโโ README.md
โย ย โย ย โโโ tree-sitter
โย ย โโโ package-lock.json
โย ย โโโ package.json
โย ย โโโ README.md
โโโ .git
โโโ .zprofile
โโโ .zsh_sessions
โย ย โโโ _expiration_check_timestamp
โย ย โโโ 0EC8B8A7-66B2-4DB2-82C0-804BC3207BD6.session
โโโ .zshrc
โโโ README.md
Pretty neat, if you ask me!
Bonus: Managing .zcompdump
Files from Oh My Zsh
Finally, I managed to move the annoying .zcompdump
filesโcreated automatically by Oh My Zsh in my home folderโinto a separate directory. This keeps my home clean and avoids clutter.
For anyone facing the same issue, here’s a helpful Stack Overflow post with instructions on how to do this.