This is my dotfiles repository. There are many like it, but this one is mine.
Intended to be a mainly macOS (but also GNU/Linux-compatible) development environment for coding in JavaScript, TypeScript, Python, and other languages with various other tools, configurations, and plugins for convenience and productivity.
- chezmoi - Dotfiles manager
- Homebrew - Package manager
brew bundle
- Bundler for Homebrew, Homebrew Cask, Mac App Store and Visual Studio Code
- iTerm2 - Terminal emulator
- Oh My Zsh -
zsh
configuration framework- colored-man-pages - Adds colors to man pages
- git - Many git aliases and a few useful functions
- zsh-users/zsh-autosuggestions - Fish-like fast/unobtrusive autosuggestions for
zsh
- zsh-users/zsh-history-substring-search - ZSHH port of Fish history search (up arrow)
- zsh-users/zsh-syntax-highlighting - Fish shell-like syntax highlighting for Zsh
- Visual Studio Code - Source-code editor
- Z Shell (zsh) - Unix shell
Using a chezmoi-first approach:
/bin/sh -c "$(curl -fsLS get.chezmoi.io)" -- -b $HOME/.local/bin init --apply jeremy-code
brew install chezmoi --adopt
Or with a Homebrew-first approach (see run_once_install_00-homebrew.sh
for more details):
# Install Homebrew with either the signed-.pkg file at Homebrew's GitHub
# releases https://github.com/Homebrew/brew/releases/latest or run the script
# from https://github.com/Homebrew/install using:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install chezmoi
chezmoi init jeremy-code --apply
Ideally, inspect either shell script before running them to ensure they are safe to run. This will be the easiest attack vector since afterwards, packages installed in homebrew-core
will be verified using cryptographic attestations of build provenance since $HOMEBREW_VERIFY_ATTESTATIONS
is enabled in home/dot_config/homebrew/brew.env.tmpl
(see Homebrew for more details).
chezmoi is used to manage the dotfiles in this repository. The source directory is the $HOME/.local/share/chezmoi/home
directory (declared in .chezmoiroot
) and the destination directory is correspondingly the user's home directory or $HOME
. The other configuration files are stored in the source directory, such as home/.chezmoiexternal.toml
.
Additional root scripts are located in the home/.chezmoiscripts
directory. These scripts are intended to be indempotent (can be run multiple times without altering the whole system). Since chezmoi runs scripts in ASCII-defined order, the scripts are prefixed with a two-digit number XX-
to define the order in which they are run if it is relevant, a convention used commonly in Debian-based systems using run-parts
or those inspired by Unix System V's init
design (see Debian/sysvinit).
run_once_00-install_homebrew.sh
- Installs Homebrew for the first time either by (1) installing the signed-.pkg
file on macOS or (2) running a Bash installation shell script on Linuxrun_once_40-mac.sh.tmpl
- Configures some macOS settings that must be done imperatively (namely using thedefaults
to configure.plist
files). Some assets needed for this script are located in the directory$HOME/.local/share/chezmoi/assets
run_once_dato.sh.tmpl
- Configures some settings for the Dato app, which must be a.tmpl
file due to containing some JSON data stored in thehome/.chezmoidata/dato.json
filerun_once_latex.sh
- Self-updatestlmgr
and installs the LaTeX packages defined in the arrayPACKAGES
run_once_update_gpg.sh.tmpl
- Updates the GPG key expiration date to 1 year from the current date if the key is set to expire within 6 months
Homebrew is used to install Homebrew formulae and casks, Mac App Store apps, and Visual Studio Code extensions. Configuration is stored in the home/dot_config/homebrew
directory.
- The
brew bundle
dependencies are defined in theBrewfile
file - When the aforementioned file is updated,
brew bundle install
is automatically ran with the scriptrun_once_after_Brewfile.sh.tmpl
- The
brew.env.tmpl
file defines additional Homebrew environment variables ($HOMEBREW_*
)
The configuration of iTerm2 is defined mainly in home/Library/Application Support/iTerm2
. The dynamic profile DynamicProfiles/profiles.json
has custom color schemes, theming, and other settings. The directory also contains the Scripts
directory for custom scripts to be used in iTerm2, such as Scripts/AutoLaunch/change_default_profile.py
which sets the default profile to the aforementioned dynamic profile on launch.
Some additional configuration is installed in home/.chezmoiscripts/run_once_40-mac.sh.tmpl
to set non-profile settings.
The configuration files of Visual Studio Code are stored in home/Library/Application Support/Code
and contains custom settings User/settings.json
, keybindings User/keybindings.json
, and code snippets User/snippets/*.json
. It uses the One Dark Pro Darker theme, Fira Code font, and Material Icon Theme. It also sets up various extensions for programming languages or library tooling (Prettier and ESLint, etc.) in addition to miscellaneous utilities such as Git Blame, carbon-now-sh, etc.
The default shell is zsh
using the framework Oh My Zsh. The base zsh
configuration files home/dot_zshrc
and home/dot_zprofile
configure Oh My Zsh and set up some necessary startup environment variables respectively. Shell scripts attempt to follow the Google Shell Style Guide as closely as possible.
Additional .sh
shell scripts are stored in home/dot_config/oh-my-zsh
directory (the $ZSH_CUSTOM
directory) which contains:
aliases.zsh
- Enables custom command aliases, suffix aliases (.zip
,.git
), and named directories (~github
and~dotfiles
)constants.zsh
- Sets custom constants for the shell environmenttelemetry.zsh
- Sets environment variables to disable telemetry and analytics for various applications
Furthermore, this directory contains a functions directory for additional functions for zsh
that are autoloaded in the aforementioned home/dot_zprofile.tmpl
file.
The plugins git and colored-man-pages are bundled with Oh My Zsh and are enabled in the .zshrc
file. Additionally, the external plugins zsh-users/zsh-autosuggestions, zsh-users/zsh-history-substring-search, zsh-users/zsh-syntax-highlighting are installed to the corresponding $ZSH_CUSTOM/plugins
directory. These external plugins along Oh My Zsh are defined in home/.chezmoiexternal.toml
as external Git repositories to be installed by chezmoi.
This project is licensed under the MIT License. See the LICENSE file for details.