I love dotfiles!

Yes, I love dotfiles! In this blog post, I won’t duplicate what others have already said. If you’d like to know what dotfiles are, their advantages of dotfiles, and more, please read the Dotfiles – What is a Dotfile and How to Create it in Mac and Linux article. You can also read other articles.

My dotfiles

Based on that, I’ve created my dotfiles: https://github.com/kniziol/dotfiles.

Included and supported

Installation

1. Clone the repo into the ~/.dotfiles directory:

git clone git@github.com:kniziol/dotfiles.git ~/.dotfiles

Attention. It’s crucial to clone the repo into the ~/.dotfiles directory, which is referenced in the dotfiles configuration.

2. Install the dotfiles:

cd ~/.dotfiles && ./install.sh

3. Restore applications’ settings:

mackup restore

Attention. You need to make a backup first by running mackup backup and sync with your cloud storage.

See more in mackup’s configuration.

Steps of the installation process

  1. Installation of Homebrew
  2. Installation of Oh My Zsh
  3. Backup of configuration files and directories from the $HOME directory
    • .zshrc
    • .p10k.zsh
    • .mackup/
    • .mackup.cfg
  4. Update of Homebrew and all installed formulae
  5. Installation of dependencies and applications – Homebrew Bundle
  6. Installation of applications from Mac App Store – mas tool
  7. Set the macOS preferences
  8. Set shell aliases

Oh My Zsh preferences

  • Uses the Powerlevel10k theme
  • Locale-related preferences:
    • LC_ALL=en_US.UTF-8
    • LANG=en_US.UTF-8
  • Enter the SSH key passphrase once and only when needed
  • Support The Fuck utility

Homebrew Bundle

The Homebrew Bundle installs all the packages and applications. Also, from the Mac App Store.

Configuration of the Homebrew Bundle is stored in the Brewfile. See below part of the configuration:

# Taps
tap 'homebrew/cask-fonts'
tap 'homebrew/cask-versions'
# ...

# Binaries
brew 'bash' # Latest Bash version
brew "bat"
# ...

# Apps
cask 'discord'
cask 'docker'
# ...

# Fonts
cask 'font-lato'
cask 'font-open-sans'
# ...

# Mac App Store
mas 'Amphetamine', id: 937984704
mas 'Bitwarden', id: 1352778147
# ...

See the full Brewfile for a list of all the packages and applications.

Mackup

Mackup is a tool for backing up applications’ preferences. See how it works. I decided to store backup in iCloud and support all applications except for:

  • Iterm2
  • Mackup
  • Powerlevel10k
  • Oh My Zsh

I don’t make backups of Iterm2 preferences because of the following issues:

Other than that, I rarely use Iterm2. I prefer Warp.

Mackup, Powerlevel10k, and Oh My Zsh preferences are stored in the dotfiles repo, so I don’t want to duplicate that.

Aliases

All aliases are defined in the aliases.zsh file. The idea was to not duplicate aliases introduced by Oh My Zsh and create really useful aliases.

See below part of all the aliases:

#
# Miscellaneous
#
alias o='open'
alias cpr='cp -r'
# ...

#
# Docker
#
alias dce='docker compose exec'
alias dcl='docker compose logs -f'
# ...

macOS preferences

Stored in the .macos file. Not all preferences are helpful for me, so I enabled only some of them. I decided to keep all preferences – maybe I will use others too in the future. Thanks to Mathias Bynens – https://mths.be/macos 💪

See below part of all the preferences:

# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# ...

# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool false
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool false
# ...

# Sleep the display after 4 minutes
sudo pmset -a displaysleep 4
# ...

Inspirations

My inspiration was the https://dotfiles.github.io page, the webpro/awesome-dotfiles repository, and articles from the Introductions section in that repository: