Dot Files and Mac Setup
Being old-fashioned, I always want simplicity and speed. That’s why I use the terminal and NeoVIM. Here’s my setup on Mac. The key is I want to keep this deadly simple, thus when there’s an OK default, I would use that instead of heavily customizing. The biggest change over the years is the inclusion of AI-based tools, like ChatGPT or access to LLM API.
How to Set Up a New Mac
- Mac desktop basics:
- Dock to the left, hide
- Allow whole-screen zoom in Accessibility (for eyesight)
- Customize modifier key, CAPS LOCK -> ESC (for vim)
- Adjust trackpad scroll speed
- Install Alfred, point settings sync to ~/settings.
- Unbind Cmd+Space from Spotlight to Alfred.
- Set screenshot to iCloud location
```
- defaults write com.apple.screencapture location “$HOME/Library/Mobile Documents/com~apple~CloudDocs/screenshots”
- killall SystemUIServer ```
- Set up the terminal
- Install iTerm2.
- Set it to load from a custom folder in:
Preferences> General > Settings
. We will recover settings later inyadm
. It’s OK for now.
- Set it to load from a custom folder in:
- Or install Gostty, which is much clearer/faster than
iTerm2
, with less features as it’s pretty new. - Install Oh My Zsh, with command:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- Additional
zsh
plugins:git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab
,git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
andgit clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
- Additional
- Get a new font, I use DejaVuSansM Nerd Font, direct link. If you are using
Ghostty
, built-in font is already good enough, so no need to install this.
- Install iTerm2.
- Set up
SSH
and access toGithub
- Assuming you don’t have the keys:
ls ~/.ssh/id\_\*
, usessh-keygen -t ed25519 -C "your-email@example.com"
to generate, and set up a passphrase to protect it. - Create ssh config file
~/.ssh/config
with the following content. This instructs ssh-add to use keychain.Host \* UseKeychain yes AddKeysToAgent yes IdentityFile ~/.ssh/id\_ed25519
- Add to key to keychain so you don’t need to keep input that passphrase:
ssh-add --apple-use-keychain ~/.ssh/id\_ed25519
- Copy your public key to Github
pbcopy < ~/.ssh/id_ed25519.pub
. Add a new SSH key there. - Test setup with
ssh -T git@github.com
- Assuming you don’t have the keys:
- Install
yadm
to recover settings- Install Homebrew, which downloads Xcode Command Line Tools. Command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Recover install brews, e.g.
brew bundle --file=~/settings/brewfile
- Or install yadm
brew install yadm
directly.
- Or install yadm
- Get your configuration:
yadm clone git@github.com:username/dotfiles.git
- Use
yadm status
and check out what the differences are. It’s great to always have a sane default. - TODO
- Install Homebrew, which downloads Xcode Command Line Tools. Command:
- Set up the terminal-based development environment.
- Get neovim:
brew install neovim
- Get Node.js
brew install node
- Get Amazon Q
brew install amazon-q
- Get Claude Code
npm install -g @anthropic-ai/claude-code
- Get OpenAI Codex
npm install -g @openai/codex
- Get neovim:
- Install other Mac Apps
ChatGPT
,Chrome
,Edge
,VimR
,WhatsApp
,Grammerly
,Zettlr
- Chrome plugins:
Grammarly
,Save Pinned Tabs
,Switch between recent tabs (MRU tabs switch)
,Video DownloadHelper
. - Safari plugins:
Grammarly
,TabBack
. - Some small utilities:
Horo
(timer),Quick View Calendar
for dates,Magnet
for window control.
- Other settings
- Some shortcuts from ~ to usual locations
- Keychain access of API keys, often for AI related things
- Set up git user name:
git config --global --edit
yadm
I started to use yadm to keep dotfiles in sync. yadm wraps around git and creates the illusion that some files and directories under $HOME
are source controlled. Otherwise, it behaves just like git
.
brew install yadm
yadm clone ...
to clone your dotfiles repo. Or check yadm manual on how to initiate a repo from yadm. I’d suggest having a separate private GitHub repo to track your configuration files.- In the ideal case, that’s all you need to do; you have recovered all the configuration files tracked by
yadm
! - To track a new file, it’s simply something like:
yadm add ~/.zshrc
. You useyadm status
to check what’s changed. Andyadm commit; yadm push
to commit and push your changes to your repo on GitHub. It basically behaves the same asgit
command. - Some additional files I track:
- Generate homebrew bundle file with
brew bundle dump --describe --file=~/.brewfile
. Recover on new host withbrew bundle --file=~/.brewfile
- ~/.crontab file contains periodical thing I run on a host. Recover on new host with
crontab ~/.crontab
Alfred
preference files in~/Alfred.alfredpreferences/
Software Shortlist on Mac
- Install iTerm2, which is vastly better than Terminal.app, especially if you need to connect to remote servers. Even just for local use, it’s pretty good.
- Install Ghostty, with is much clearer/faster than
iTerm2
, with less features as it’s pretty new. For example, there’s no native integration with tmux on remote servers, meaning you can’t map remote tmux operations to local window operations. But if you mainly use local terminal, it is already a good enough replacement of iTerm2. Example configurations:font-family = DejaVuSansM Nerd Font Mono font-size = 15 theme = Apple System Colors keybind = cmd+left=previous_tab keybind = cmd+right=next_tab keybind = cmd+shift+left=move_tab:-1 keybind = cmd+shift+right=move_tab:+1 keybind = cmd+c=copy_to_clipboard keybind = cmd+v=paste_from_clipboard keybind = cmd+i=write_screen_file:paste keybind = cmd+d=new_split:right keybind = cmd+shift+d=new_split:down keybind = cmd+shift+enter=toggle_split_zoom keybind = cmd+shift+equal=equalize_splits copy-on-select = clipboard
- Install Alfred. I use the
1/
multi clipboard,2/
global hot keys, and3/
snippets (e.g. having quick access to ASCII art like¯\_(ツ)_/¯
, for example). - Use
zsh
, a modern shell. - Use Oh My Zsh to customize your
zsh
. It adds all the cool bars and fonts here and there, and also much better command completion. It does all those largely out of the box. - Install HomeBrew, which makes installing software on Mac much easier. e.g.
rg
,ack
,nvim
, etc. - You will need some fonts to display some weird Unicode codepoints. I use nerd fonts, in particular,
DejaVuSansMNerdFontPropo-Regular.ttf
. - Some small utilities:
Horo
(timer),Quick View Calendar
for dates,Magnet
for window control.