My macOS / Ubuntu / WSL 2 / RHEL dotfiles.
Browseable docs: https://dotfiles.lindjo.no
Forked from https://github.com/runesto/dotfiles
- About this project
- How the "dotfiles" command works
- Hacking my dotfiles
- Installation
- Aliases and Functions
- Scripts
- Tips
- License
I finally decided that I wanted to be able to execute a single command to "bootstrap" a new system to pull down all of my dotfiles and configs, as well as install all the tools I commonly use. In addition, I wanted to be able to re-execute that command at any time to synchronize anything that might have changed. Finally, I wanted to make it easy to re-integrate changes back in, so that other machines could be updated.
That command is dotfiles, and this is my "dotfiles" Git repo.
When dotfiles is run for the first time, it does a few things:
- Git is installed if necessary (via APT on Ubuntu, already present on macOS).
- This repo is cloned into your user directory, under
~/.dotfiles. - Files in
/copyare copied into~/. (read more) - Files in
/linkare symlinked into~/. (read more) - You are prompted to choose scripts in
/initto be executed. The installer auto-selects scripts based on OS (e.g.,_macos_scripts are only selected on macOS). Scripts with_personal_in the filename are default unchecked. - Your chosen init scripts are executed (in alphanumeric order, hence the funky names). (read more)
On subsequent runs, step 1 is skipped, step 2 just updates the already-existing repo, and step 5 remembers what you selected the last time. The other steps are the same.
- The
/backupsdirectory gets created when necessary. Any files in~/that would have been overwritten by files in/copyor/linkget backed up there. - The
/bindirectory contains executable shell scripts (including the dotfiles script) and symlinks to executable shell scripts. This directory is added to the path. - The
/cachesdirectory contains cached files, used by some scripts or functions. - The
/confdirectory stores app configuration files (Sublime Text, IntelliJ) that are linked into app-specific locations by dedicated init scripts. - The
/hooksdirectory contains git hooks that are symlinked into.git/hooks/by init/12_git_hooks.sh. - The
/sourcedirectory contains files that are sourced whenever a new shell is opened (in alphanumeric order, hence the funky names). - The
/testdirectory contains unit tests for especially complicated bash functions. - The
/vendordirectory contains third-party libraries (zsh plugins as git submodules). - The
/websitedirectory is a Docusaurus site that renders the README,TIPS.md, andtips/files for GitHub Pages. Built and deployed by .github/workflows/deploy-docs.yml. Runcd website && npm install && npm startto develop locally.
Any file in the /copy subdirectory will be copied into ~/. Sensitive information is managed via git-secrets, but files that may need local edits (like copy/.gitconfig) should be copied rather than linked as a second line of defense. Because the file you'll be editing is no longer in ~/.dotfiles, it's less likely to be accidentally committed into your public dotfiles repo.
Any file in the /link subdirectory gets symlinked into ~/ with ln -s. Edit one or the other, and you change the file in both places. Don't link files containing sensitive data, or you might accidentally commit that data! If you're linking a directory that might contain sensitive data (like ~/.ssh) add the sensitive files to your .gitignore file!
Scripts in the /init subdirectory will be executed. A whole bunch of things will be installed, but only if they aren't already.
- XCode Command Line Tools via init/11_macos_xcode.sh
- Homebrew via init/20_homebrew.sh
- Homebrew recipes via init/31_homebrew_recipes.sh
- Homebrew casks via init/32_macos_homebrew_casks.sh
- Flatpak (Linux desktop) via init/21_linux_flatpak.sh and init/32_linux_flatpak_apps.sh
- Winget (WSL) via init/22_wsl_winget.sh and init/32_wsl_winget_apps.sh
- Homebrew via init/20_homebrew.sh
- Homebrew recipes via init/31_homebrew_recipes.sh
- SSH config and private keys via init/10_ssh_private_keys.sh
- Git hooks (symlinked from
/hooks) via init/12_git_hooks.sh - Sublime Text settings via init/51_sublime_text.sh
Because the dotfiles script is completely self-contained, you should be able to delete everything else from your dotfiles repo fork, and it will still work. The only thing it really cares about are the /copy, /link and /init subdirectories, which will be ignored if they are empty or don't exist.
If you modify things and notice a bug or an improvement, file an issue or a pull request and let me know.
Also, before installing, be sure to read my gently-worded note.
You need to have XCode or, at the very minimum, the XCode Command Line Tools, which are available as a much smaller download.
The easiest way to install the XCode Command Line Tools is to open up a terminal, type xcode-select --install and follow the prompts.
You should at least update/upgrade APT with sudo apt-get -qq update && sudo apt-get -qq dist-upgrade first.
If you're not me, please do not install dotfiles directly from this repo!
Why? Because I often completely break this repo while updating. Which means that if I do that and you run the dotfiles command, your home directory will burst into flames, and you'll have to go buy a new computer. No, not really, but it will be very messy.
- Read my gently-worded note
- Fork this repo
- Open a terminal/shell and do this (change
andrelinandmainas appropriate):
export DOTFILES_GH_USER=andrelin
export DOTFILES_GH_BRANCH=main
bash -c "$(wget -qO- https://raw.github.com/$DOTFILES_GH_USER/dotfiles/$DOTFILES_GH_BRANCH/bin/dotfiles)" && source ~/.zshrcexport DOTFILES_GH_USER=andrelin
export DOTFILES_GH_BRANCH=main
bash -c "$(curl -fsSL https://raw.github.com/$DOTFILES_GH_USER/dotfiles/$DOTFILES_GH_BRANCH/bin/dotfiles)" && source ~/.zshrcSince you'll be using the dotfiles command on subsequent runs, you'll only have to set the DOTFILES_GH_USER variable for the initial install, but if you have a custom branch, you will need to export DOTFILES_GH_BRANCH for subsequent runs.
There's a lot of stuff that requires admin access via sudo, so be warned that you might need to enter your password here or there.
bash -c "$(wget -qO- https://raw.github.com/andrelin/dotfiles/main/bin/dotfiles)" && source ~/.zshrcbash -c "$(curl -fsSL https://raw.github.com/andrelin/dotfiles/main/bin/dotfiles)" && source ~/.zshrcTo keep things easy, the ~/.zshrc and ~/.bashrc files are very simple, and should never need to be modified. Instead, add your aliases, functions, settings, etc into one of the files in the source subdirectory, or add a new file. They're all automatically sourced when a new shell is opened. Take a look, I have a lot of aliases and functions.
The /bin directory is added to $PATH and contains:
- dotfiles - (re)initialize dotfiles. It might ask for your password (for
sudo). - eachdir - run one or more commands in one or more directories.
- isip - list bound IP addresses, or check if a specific IP is bound.
- sync-claude-deny - sync git-secret paths into Claude Code deny rules. Use
--checkto verify without modifying. - sort-claude-settings - sort arrays in Claude Code settings files for deterministic output.
The src function (defined in .zshrc and .bashrc) re-sources all files in /source, useful after making changes without opening a new shell.
A growing index of terminal tricks, repo features, and bundled-tool basics lives in TIPS.md, with one file per category under tips/. Run tips in a shell to print them all, tips <FILE> (e.g. tips 22) for one section, tips <FILE>.<N> (e.g. tips 22.3) for a single tip, tips <D>x for a whole decade, tips -l to list titles, or tips -h for usage.
Copyright © 2022-2026 Andreas Lind-Johansen Licensed under the MIT license.