Written by Kevin Unkrich on

MacOS Base Setup / dotfiles

MacOS Base Setup

The following is a detailed list of the base MacOS setup that I use which is somewhat programmatically accessible via my dotfiles repository.

For a while this lived as a note on my local machine: tracking an application list of everything I have installed, MacOS system changes, and other setup details.

I manage to mess up my mac environment often enough that it was easiest to be able to start over from scratch with all of the configuration and settings I like with certainty and reproducibility more than fixing it at any given point.

While the script does a great job at automating a lot of the work, many things can’t be automated - or I simply decided that it didn’t make sense. Ideally this post serves as a template to explain the setup I’ve created here, and adds additional context for manual steps.

It’s been influenced by many others’ setups which deserve quite a bit of credit. Hopefully I can add more of these resources below as I rediscover them.

Applications

These are installed via brew in the .homebrew file/script. There are some base dependencies also installed alongside in the script not listed here.

Unix

  • tmux
  • nvim
  • watchman
  • jq
  • tree
  • z
  • tig

MacOS Apps

  • iTerm2
  • Google Chrome
  • Notion
  • Slack
  • Discord
  • Spotify
  • Cron
  • SuperHuman
  • Postman
  • Zoom
  • Linear
  • Microsoft Office Suite
  • Ledger Live
  • 1Password
  • qBittorrent
  • VLC Media Player
  • KiCad
  • Openscad
  • PrivateInternetAccess
  • OBS
  • Zappy
  • Muzzle
  • Arq
  • PgAdmin4
  • Docker (Desktop)
    • Docker Compose
  • Logitech Options
  • Paste App
  • Dash
  • Lumina - manual install

Development

  • git
  • gh
  • heroku CLI
  • terraform
  • packer
  • awscli
  • ffmpeg
  • postgresql
  • redis
  • sqlite3
  • mysql

Programming Environments

While not currently the most dependable script, I have the basis for setting up the most common programming environments and languages that I rely on.

  • Here’s the list
    • Ruby
    • Node / JavaScript via nvm
      • npm, yarn
    • Parity
    • Truffle
    • Netlify
    • Python 2 / 3 via pyenv
    • Rust
    • Java
    • Clojure
      • Leiningen

Other

  • notunes
  • dockutil

MacOS Defaults

There are a number of defaults that I have added to my system over time. Instead of diving into System Preferences repeatedly, they are scripted in the .macos file whenever possible.

General

  • Siri
    • Disable “Ask Siri”
    • Remove Siri icon from Status Menu
  • External Devices
    • Prevent Photos from opening automatically when devices are plugged in
    • Prevent Time Machine from prompting to use new hard drives as backup volumes
  • Screenshots
    • Change default location of screenshots saved
    • Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
    • Disable shadow in screenshots
  • Automatically quit printer app once the print jobs complete
  • Increase sound quality for Bluetooth headphones/headsets
  • Disable animations when opening and closing windows.
  • Accelerated playback when adjusting the window size.
  • Dont rearrange spaces based on recent use

Finder

  • Show filename extensions
  • Enable showing dotfiles (just hold Cmd + Shift + . (dot) in a Finder window)
  • Show full path in Finder
  • Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
  • Show icons for hard drives, servers, and removable media on the desktop
  • Disable the warning when changing a file extension
  • Avoid creating .DS_Store files on network or USB volumes
  • Automatically open a new Finder window when a volume is mounted
  • Use list view in all Finder windows by default*
  • Show the ~/Library folder*
  • Disable the “Are you sure you want to open this application?” dialog
  • denotes that it may not be working right now.

Text / Keyboard

  • Disable automatic capitalization as it’s annoying when typing code
  • Disable smart dashes as they’re annoying when typing code
  • Disable automatic period substitution as it’s annoying when typing code
  • Disable smart quotes as they’re annoying when typing code
  • iMessage - Disable smart quotes as it’s annoying for messages that contain code
  • Disable auto-correct
  • Enable Tab in modal dialogs
  • Change keyboard delay / repeat

Dock

  • Display the following applications via dockutil
    • Google Chrome
    • Messages
    • Cron
    • Superhuman
    • Zoom
    • Slack
    • Notion
    • iTerm
    • Notes
    • System Preferences
  • Hide Dock
  • Set Dock to left-hand side
  • Remove the auto-hiding Dock delay
  • Remove the animation when hiding/showing the Dock
  • Automatically hide and show the Dock
  • Don’t show recent applications in Dock
  • Set the icon size of Dock items to 30 pixels
  • Speed up Mission Control animations
  • Enable bluetooth icon in status bar

Spotlight

  • Only index*
    • Applications
    • System Preferences
    • Directories
    • PDFs
  • may not be working

Chrome

  • Set as default browser
  • Disable backswipe on magic mouse / trackpad
  • Use the system print dialog and expand dialog by default

Terminal / Development

nvim

Make sure to run :PackerSync to install.

There are a number of settings in this file and it needs further organization and a better write up than the below.

One thing to note is that I try to make use of the built-in LSP support for languages.

  • Plugins
    • Packer - Package management*
    • Git
      • tpope/vim-fugitive - Git commands in nvim
      • tpope/vim-rhubarb - Fugitive-companion to interact with GitHub
      • lewis6991/gitsigns - Add git related info in the signs columns and popups
      • vim-airline/vim-airline - Git branch displayed
    • Visual
      • mhartington/oceanic-next
      • itchyny/lightline.vim - Fancier statusline
      • lukas-reineke/indent-blankline - Add indentation guides even on blank lines
      • nvim-treesitter/nvim-treesitter - Highlight, edit, and navigate code using a fast incremental parsing library
      • nvim-treesitter/nvim-treesitter-textobjects - Additional textobjects for treesitter
    • tpope/vim-commentary - “gc” to comment visual regions/lines*
    • ludovicchabant/vim-gutentags - Automatic tags management
    • nvim-lua/popup.nvim
    • ‘nvim-lua/plenary.nvim’
    • nvim-telescope/telescope.nvim
    • nvim-telescope/telescope-fzy-native
    • neovim/nvim-lspconfig - Collection of configurations for built-in LSP client
    • hrsh7th/nvim-cmp - Autocompletion plugin
    • hrsh7th/cmp-nvim-lsp
    • saadparwaiz1/cmp_luasnip
    • L3MON4D3/LuaSnip - Snippets plugin

zsh

Aliases, theme/plugin setup, path exports.

tmux

  • Remap from ‘C-b’ to ‘C-a’
  • Start with window 1 (instead of 0) and pane 1
  • Split panes using | and -
  • Open new windows in the current path
  • Reload config file with ‘r’
  • Set ‘p’ to previous window, set ‘n’ to next window
  • Shorten command delay
  • Enable mouse control
  • Don’t rename windows automatically
  • Set noises to be quiet
  • Update colors and status bar design

Automated Backups

While I regularly use Time Machine (built into MacOS) in order to do computer backups, I generally file everything that I intend to move from computer to computer and keep long-term in a folder structure under the root directory “box”.

I then use Arq to schedule regular backups of this folder to a cloud storage location.

Most of the work and files that I do is in some directory of /box. Most files that exist outside of /box are considered there for temporary purposes as a result of the operating system (e.g. screenshots & downloads).

I don’t want them forever - and I wouldn’t mind so much if I lost them - but they are convenient to have on my local system. This gives me peace of mind that I can switch from computer to computer bringing ‘box’ with me without dropping any critical files.

I also symlink some of the folders in ‘box’ over to the existing folders on the system (e.g. Documents, Photos, etc.)

Unfortunately setting up and running this process is not currently automated - a tradeoff of using a simple consumer-oriented tool for backups instead of setting up my own process.

Future File Management

In the future, I would love to use something such as Hazel in order to do automatic file management and organization to improve ‘box’. Possibly setting up a system similar to the one described by Wolfram in his personal infrastructure blog post.

Experimental

The following is a bit more experimental in nature. While I find that these tools make my experience working with MacOS much more enjoyable and customizable, they require overriding security defaults and other settings that I can’t recommend others to do ‘automatically’.

yabai

  • Automatically focus on window under mouse
  • New window spawns to the right if vertical split, or bottom if horizontal split
  • Turn off window opacity for inactive windows, but leave shadow on
  • Modify window shadows (default: on, options: on, off, float)
  • Turn on window opacity for active windows
  • Layout in tile using binary space partitioning algorithm
  • Remove all padding from windows
  • Set top padding to 0 and leave space for spacebar
  • Space defaults*
    • Superhuman and Cron in space 1
    • Messages and Slack in space 2
    • Notion in space 3
    • Chrome in space 4
    • iTerm in Space 5
  • may not be working

skhd

I used to have a lot more commands in skhd to control moving and focusing on windows to not have to touch the mouse as often, but I found that I added too many at once, so this may slowly update and evolve as I add them back in.

Today the strategy is to adopt my current tmux setup to navigate macos.

  • tmux -like defaults for navigating macos spaces
    • cmd+ctrl-<1:9>, switch to space number
    • cmd+ctrl-, next/previous space
      • ctrl-, next/previous space
    • cmd+ctrl-, delete/create space
  • cmd+ctrl+f - fullscreen a window

spacebar

Very little configuration at the moment.

The space number I’m in is shown at all times in the top left corner because it turns out eliminating animations on space changes is disorienting at first as you try to understand which space you are now in.

Also has the battery percentage and time.

This is another area where I plan to improve configuration moving forward.

References

https://www.taniarascia.com/setting-up-a-brand-new-mac-for-development/?ck_subscriber_id=591519942

https://www.swyx.io/new-mac-setup

https://jasoneckert.github.io/myblog/customizing-macos-for-development/skhdrc.txt

https://github.com/koekeishiya/skhd/issues/152

Note: there are many more that were used that I have yet to add as references here yet.