These are the dotfiles I use on my Mac system, currently running MacOS Ventura. My editor of choice is Neovim, but I also use VSCode occasionally. The instructions are adapted from Joshua Steele's dotfiles repository.
- Prerequisites
- Installation
- Zsh Setup
- Fish Setup
- Post-install Tasks
- Setting up iTerm2
- Setting up iTerm2
- Setting up yabai and skhd
- Backing up app settings and personal files
- Colorschemes
- My Favorite Programming Fonts
- Some cool dotfile repos
- Helpful web resources on dotfiles, et al.
The dotfiles assume you are running macOS with the following software pre-installed:
I'm using a bare git repo with its working tree set to my home directory to manage my dotfiles without symlinks.
-
Setup your shell. (See Fish/Zsh instructions below.)
-
Run the following commands in the shell to clone the dotfiles:
$ echo ".cfg" >> $HOME/.gitignore
$ git clone --bare 'https://github.com/Subjective/dotfiles.git' $HOME/.cfg
$ alias dotfiles='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
$ dotfiles config --local status.showUntrackedFiles no
$ dotfiles checkout
$ dotfiles sparse-checkout set --no-cone '/*' '!LICENSE'
$ dotfiles config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
$ dotfiles remote update
$ dotfiles branch -u origin/main
I recently switched from Oh My Zsh to Zim as my primary Zsh configuration framework/plugin manager. Not only is it much faster, but it also handles automatic installation and updating of custom plugins. If you want to learn more, check out this post.
- Install zsh:
$ brew install zsh
- Install custom plugins:
$ zimfw install
- Install fish:
$ brew install fish
- Install fisher:
$ curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
- Restart your computer.
- Install tide theme:
$ fisher install IlanCosman/tide@v5
After cloning the dotfiles repo there are still a couple of things that need to be done.
- Set up iTerm2 or Kitty profile (see details below).
- Complete Brew Bundle and install packages with
$ brew bundle install
- Install Rust via Rustup:
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Install neovim via bob:
$ cargo install bob-nvim
- After opening Neovim, run
:checkhealth
and resolve errors/warnings. - If using Fish, customize your setup by running the
$ fish_config
command.
- Open iTerm2.
- Select iTerm2 > Preferences.
- Under the General tab, check the box labeled "Load preferences from a custom folder or URL:"
- Press "Browse" and point it to
~/.config/iterm2/com.googlecode.iterm2.plist
. - Restart iTerm2.
Getting set up after a fresh install is simple.
- Tweak preferences in
~/.config/kitty/kitty.conf
- Uncomment Alacritty terminfo lines in
~/.tmux.conf
- Setup alternative MacOS application icon for Kitty.
- Run Kitty!
I use a tiling window manager called yabai to manage my windows and workspaces and the hotkey daemon skhd to customize yabai's keyboard shortcuts. However, in order to enable all of of yabai's features such as border highlights, instant switching between spaces, and window animations, System Integrity Protection (SIP) must be partially disabled.
- Partially Disable System Integrity Protection according the yabai docs.
- Configure Scripting Addition according to the yabai docs
- Start yabai and skhd:
$ yabai --start-service
$ skhd --start-service
Mackup is a fantastic tool that allows you to: backup personal application settings and private data; sync that data between computers; and then easily restore your configuration to a fresh install — all in a simple command line interface. Seems good!
While by no means a comprehensive backup solution, Mackup keeps things simple, currently supports over 360 applications and can store data on Dropbox, Google Drive, iCloud or any path you can copy to.
I store on iCloud and explicitly declare which apps to sync and which to ignore — anything handled by my dotfiles is ignored (bash, git, vim etc.)
I backup a wide range of other applications including those containing credentials such as aws, gnupg and ssh. It's also possible to backup apps not natively supported using custom .cfg
files. For example, to backup Ulysses (an amazing markdown writing app), create a ~/.mackup
directory and place a ulysses.cfg
file inside:
[application]
name = Ulysses
[configuration_files]
Library/Preferences/com.soulmen.ulysses3.plist
Library/Preferences/com.ulyssesapp.mac.plist
It is usually straight-forward to find which .plist
files in Library/Preferences
you'll need to list, they always feature the application name.
Taking that a step further we can also declare a "personal files" application using a personal-files.cfg
and then cherry pick any other files we want to backup while keeping them out of a public repo:
[application]
name = Personal Files
[configuration_files]
.gitconfig.local
.extra
When I declare this in my main .mackup.cfg
they are handled with ease:
[storage]
engine = iCloud
directory = Mackup
# Apps to sync — if empty, syncs all supported.
# custom: personal-files, ulysses
[applications_to_sync]
personal-files
spotify
...
ulysses
A simple $ mackup backup
saves everything to iCloud and I can later $ mackup restore
on a fresh install to get these settings back (you can also easily $ mackup uninstall
).
My all-time favorite colorscheme for code-editing is Catppuccin. That said, there are times when I like to dabble with something new, just to have some variety.
Example of a React app with the Catppuccin colorscheme
Here's how everything is organized:
The settings for individual colorschemes are stored in . To add a new colorscheme, add a file for it here.
Since I use vim in the terminal, I need corresponding iTerm2 or Kitty colorschemes for every vim colorscheme. My iTerm2 colorschemes are stored in itermcolors/
, but of course must be added manually to the iTerm profile. Kitty colorschemes are defined in ~/.config/kitty/themes/
and can be set with kitty's built-in theme manager: $ kitty +kitten themes --reload-in=all
.
Multiple pre-made colorschemes are available online for both iTerm2 and Alacritty:
The last tweak is for Tmux. I like to set a custom statusline depending on what colorscheme I'm using. The main tmux.conf
file contains all the settings that Tmux needs. Uncomment the section for a specific statusline to enable it.
## Detailed Catppuccin Statusline ##
# Set status bar color to match background
set-option -g status-style bg=default
## Set status bar position to top
# set-option -g status-position top
## Change spacing between window and statusline
if -F '#{!=:#{status},2}' {
set -Fg 'status-format[1]' '#{status-format[0]}'
set -g 'status-format[0]' ''
set -g status 2
}
[...]
I also use tmux plugin manager to manage my tmux plugins. Clone the repository and press prefix
+ I
to install plugins:
$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
I've recently branched out to explore some of the different mono-spaced fonts available, both free and premium. Here is a list of my favorites.
Included in my Brewfile
and installed by default via Homebrew Cask Fonts
You have to give people money if you want these. 🤑
I first discovered ligatures through Fira Code, which IMO is probably the king of programming fonts. After using Fira Code, it's hard to go back to a sans-ligature typeface. Therefore †all the fonts I've included in my fave's list do include ligatures, although some have more than others.
† Operator Mono does not include ligatures but can be easily patched to add them.
I use Devicons in my editor, and these require patched fonts in order to display properly. For most free fonts, there are pre-patched Nerd Font variants that include the various glyphs and icons.
Homebrew Cask Fonts includes both original and Nerd Font variants. For example:
# Original font
$ brew cask install font-fira-code
# Patched variant
$ brew cask install font-firacode-nerd-font
If using a font that does not have a patched variant (e.g. MonoLisa) iTerm2 has an option to use an alternate font for non-ASCII characters.
- Joshua Steele (https://github.com/joshukraine/dotfiles)
- Pro Vim (https://github.com/Integralist/ProVim)
- Aaron Bates (https://github.com/aaronbates/dotfiles)
- Trevor Brown (https://github.com/Stratus3D/dotfiles)
- Chris Toomey (https://github.com/christoomey/dotfiles)
- thoughtbot (https://github.com/thoughtbot/dotfiles)
- Lars Kappert (https://github.com/webpro/dotfiles)
- Ryan Bates (https://github.com/ryanb/dotfiles)
- Ben Orenstein (https://github.com/r00k/dotfiles)
- Joshua Clayton (https://github.com/joshuaclayton/dotfiles)
- Drew Neil (https://github.com/nelstrom/dotfiles)
- Kevin Suttle (https://github.com/kevinSuttle/OSXDefaults)
- Carlos Becker (https://github.com/caarlos0/dotfiles)
- Zach Holman (https://github.com/holman/dotfiles/)
- Mathias Bynens (https://github.com/mathiasbynens/dotfiles/)
- Paul Irish (https://github.com/paulirish/dotfiles)
- Tnixc (https://github.com/Tnixc/dots)
- AsianKoala (https://github.com/AsianKoala/dotfiles)
- Benjamin Brast-McKie (https://github.com/benbrastmckie/.config)
- http://dotfiles.github.io/
- https://medium.com/@webprolific/getting-started-with-dotfiles-43c3602fd789
- http://code.tutsplus.com/tutorials/setting-up-a-mac-dev-machine-from-zero-to-hero-with-dotfiles--net-35449
- https://github.com/webpro/awesome-dotfiles
- http://blog.smalleycreative.com/tutorials/using-git-and-github-to-manage-your-dotfiles/
- http://carlosbecker.com/posts/first-steps-with-mac-os-x-as-a-developer/
- https://mattstauffer.co/blog/setting-up-a-new-os-x-development-machine-part-1-core-files-and-custom-shel
- https://www.ackama.com/what-we-think/the-best-way-to-store-your-dotfiles-a-bare-git-repository-explained/
- https://www.atlassian.com/git/tutorials/dotfiles
- https://harfangk.github.io/2016/09/18/manage-dotfiles-with-a-git-bare-repository.html
Copyright © 2023 Joshua Yin. MIT License