Fresh install of macOS

Installing and restoring your applications and settings

Sunday, November 17, 2019

Whatever the reason is for re-installing the applications and settings on your mac, it can be a lot of work. Over the years you get used to working in a certain way with specific tooling and settings.

Installing everything from scratch is cumbersome at least. In this post I wrote down how I restore my configuration. It is based on a cleanly installed mac. Everything is installed from scratch only most of it is now automated.

An alternative could be to use Timemachine but that would also restore stuff you might not need/want anymore and when you have new different hardware, you might run into trouble.

The focus of this article is installing the desired configuration, my data is synchronised and backed-up elsewhere.

(Re-)Install “Homebrew” applications

Install Apple Command Line Tools

xcode-select --install

Install homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install bundle

brew tap homebrew/bundle

Copy your bundle file to ~

Copy or download the ‘Brewfile’.

cp [path to `Brewfile`] ~

Install the files from your Bundlefile

The following command (re-)installs all your “homebrew” applications from the “Brewfile”.

brew bundle

Configure with dotfiles

Read and modify the file macos to your preferences and set the configuration.

source macos

Install Settings Sync extension in VSCodium

Install the Shan Khan’s Settings Sync extension.

Synchronize your settings from your Gist.

Restore application settings with Mackup

Mackup is a tool to backup and restore configuration-settings from different applications.

Create Mackup Config file

By default, Mackup syncs all application data via Dropbox, but may be configured to exclude applications or use a different backend with a .mackup.cfg file. Create a file with the name ~/.mackup.cfg with the following content:

[storage]
engine = icloud

Restore application settings

mackup restore

Remaining configurations

PopClip

Add PopClip extensions:

  • Copy Markdown
  • Lowercase
  • Notes
  • Underscore

Wireguard

Use the “Import tunnel(s) from file” option to restore you Wireguard tunnels.

Remaining applications

Calibre

Download Calibre, install and configure.

  • location of the library (in my case the NFS mount)
  • setup email

This is the current version of my “brewfile”. The initial version was created with brew bundle dump, later the comments were added. With this file you can install Homebrew, Homebrew Cask, Mac App Store and Whalebrew dependencies.

Most of the lines are documented, determine what you want to keep and what to skip from this file.

Latest version [27-08-2020]

tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/core"
tap "homebrew/cask-fonts"
tap "homebrew/cask-versions"        # for Firefox Developer Edition
tap "candid82/brew"
tap "romkatv/gitstatus"
tap "romkatv/powerlevel10k"
tap "yqrashawn/goku"
tap "zaquestion/tap"                # for lab, a Git wrapper for GitLab.
                                    # See https://zaquestion.github.io/lab/

brew "ack"                          # Search tool like grep, but optimized for programmers
brew "ansible"                      # Automate deployment, configuration, and upgrading
brew "asciinema"                    # Record and share terminal sessions
brew "bat"                          # cat on steroids (https://github.com/sharkdp/bat)
brew "bitwarden-cli"                # Secure and free password manager for all of your devices
brew "certbot"                      #
brew "coreutils"                    # GNU File, Shell, and Text utilities
                                    # Install GNU core utilities (those that come with macOS are outdated).
                                    # Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`.
brew "cowsay"                       # Configurable talking characters in ASCII art.
                                    # Try `for i in $(cowsay -l); do cowsay -f $i "$i"; done`
brew "exa"                          # Modern replacement for 'ls'
brew "exiv2"                        # EXIF and IPTC metadata manipulation library and tools
brew "faas-cli"                     # OpenFaas CLI tool
brew "findutils"                    # Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed.
brew "fortune"                      # Infamous electronic fortune-cookie generator (cli-fun)
brew "git"                          # Distributed revision control system
brew "git-lfs"                      # Git "Large File Support"
brew "gnu-sed"                      # GNU implementation of the famous stream editor
brew "glib"                         # ?? dependency ??
brew "gnu-sed"                      #
brew "go"                           # Open source programming language to build simple/reliable/efficient software
brew "grep"                         # GNU grep, egrep and fgrep
brew "highlight"                    # Convert source code to formatted text with syntax highlighting
brew "htop"                         # Improved top
brew "httpie"                       # User-friendly cURL replacement (https://httpie.org/), http httpbin.org/status/418
brew "hub"                          # Add GitHub support to git on the command-line
brew "hugo"                         # Configurable static site generator
brew "imagemagick"                  # Software suite for displaying, converting, and editing raster image and vector image files.
brew "jq"                           # Lightweight and flexible command-line JSON processor.
brew "kubernetes-cli"               # Kubernetes command-line interface
brew "helm"                         # The Kubernetes package manager
brew "zaquestion/tap/lab"           # A Git Wrapper for GitLab
brew "libyaml"                      # YAML Parser
brew "lftp"                         #
brew "lolcat"                       # Rainbows and unicorns in your console! (cli-fun, `fortune | cowsay | lolcat`)
brew "lua"                          # ?? dependency ??
brew "lynx"                         # Text-based web browser
brew "mackup"                       # Keep your Mac's application settings in sync. Settings stored in iCloud (.mackup.cfg => "[storage]/nengine = icloud"). 'mackup restore' to put settings back. Beware when you use it on multiple Macs.
                                    # Good read on this: https://stackoverflow.com/questions/60354494/sync-macos-settings-using-mackup
brew "mas"                          # Mac App Store command-line interface
brew "mkdocs"                       # Project documentation with Markdown
brew "moreutils"                    # Install some other useful utilities like `sponge`.
brew "mosh"                         # Remote terminal application
brew "nmap"                         # Port scanning utility for large networks
brew "node"                         # Platform built on V8 to build network applications
brew "openssh"                      # ?? Still required ??
brew "p7zip"                        # 7-Zip (high compression file archiver) implementation
brew "packer"                       # Create machine and container images for multiple platforms from a single source configuration.
brew "pandoc"                       # A universal document converter.
brew "pigz"                         # Parallel gzip
brew "pv"                           # Pipe Viewer is an Open Source tool to monitor the progress of data through a pipeline between any two processes, giving a progress bar, ETA, etc.
brew "rename"                       # ??
brew "ripgrep"                      # Faster version of grep (rg).
brew "rlwrap"                       # ??
brew "screen"                       # Terminal multiplexer with VT100/ANSI terminal emulation
brew "ssh-copy-id", link: true      # Add a public key to a remote machine's authorized_keys file
brew "telnet"                       # ?? User interface to the TELNET protocol
brew "testssl"                      # Tool which checks for the support of TLS/SSL ciphers and flaws
brew "tmux"                         # Terminal multiplexer
brew "trash"                        # CLI tool that moves files or folder to the trash
brew "tree"                         # Display directories as trees (with optional color/HTML output)
brew "unar"                         # Command-line unarchiving tools supporting multiple formats
brew "upx"                          # Compress/expand executable files
brew "vbindiff"                     # VBinDiff (Visual Binary Diff) displays files in hexadecimal and ASCII (or EBCDIC).
brew "vim"                          # ??
brew "webkit2png"                   # Makes screenshots of web pages
brew "wget"                         # Install wget
brew "woff2"                        # ?? Fonts ??
brew "zopfli"                       # New zlib (gzip, deflate) compatible compressor
brew "xz"                           # General-purpose data compression with high compression ratio
brew "yqrashawn/goku/goku"          # Goku generates karabiner-elements configuration

cask "appzapper"                    # Paid "uninstaller", free alternative "appcleaner"
cask "authy"                        # Part of Twillio
cask "balenaetcher"                 # Create bootable USB or SD card
cask "bettertouchtool"              #
# cask "bartender"                  # Considering buying
cask "boostnote"                    # Intuitive and stylish markdown note app for developers
cask "bitwarden"                    # Password management
cask "caption"                      # Download subtitles
cask "cheatsheet"                   # Handy tool to display keyboard shortcuts
cask "discord"                      #
cask "drawio"                       # Read https://www.diagrams.net/blog/move-diagrams-net, it's moving to an open source version https://diagrams.net
cask "dropbox"                      # Looking for an alternative since they are changing the rules of the game
cask "fing"                         #
cask "fing-cli"                     # Network discovery
cask "firefox-developer-edition"    # Privacy enabled browser guidelines implemented from
                                    # [https://blokt.com/guides/best-secure-browsers-for-private-browsing] and
                                    # [https://www.privacytools.io/browsers/#about_config]
#cask "google-chrome"               # Replace by Brave or Iridium browser
cask "hammerspoon"                  # Use with Karabiner-elements to create "hyper"-key and shortcuts
cask "handbrake"                    #
cask "iina"                         # Mediaplayer
cask "iridium"                      # Chrome base browser with privacy focus
cask "iterm2"                       # Better terminal version
cask "karabiner-elements"           # Low-level keyboard tool. Create "hyper"-key from capslock,
                                    # switch keys on non-macos keyboard etc. Use together with Hammerspoon or not.
cask "licecap"                      # Simple animated screen captures
cask "netnewsreader"                # RSS reeder
cask "multipass"                    # CLI to manage and play with (Ubuntu) Linux instances
cask "obsidian"                     # ??
cask "paw"                          # Native version of "Postman"
cask "scapple"                      # Mindmapping differently
cask "signal"                       # OpenSource privacy first communication app
cask "suspicious-package"           #
cask "typora"                       # Minimal MarkDown editor, uses native filesystem
cask "valentina-studio"             #
cask "vlc"                          # Mediaplayer and more
cask "vscodium"                     # Visual Studio code without the metrics sending stuff.

# Quicklook
cask "qlcolorcode"                  # ??
cask "qlmarkdown"                   # ??
# cask "qlstephen"                  # no longer working
# cask "quicklook-csv"              # ??
cask "quicklook-json"               #

# Fonts (https://github.com/Homebrew/homebrew-cask-fonts)
cask "font-fira-code"               # Font used in VSCodium/Visual Studio Code
cask "font-fira-sans"
cask "font-fira-mono-for-powerline"
#cask "font-source-code-pro"
#cask "font-source-sans-pro"
#cask "font-source-serif-pro"
cask "font-robotomono-nerd-font-mono"
cask "font-source-code-pro-for-powerline"

# Applications installed via the AppStore
mas "1Password", id: 443987910
mas "Airmail", id: 918858936
mas "Amphetamine", id: 937984704
#mas "Bear", id: 1091189122
mas "Cathode", id: 499233976        # Fun console
mas "Day One", id: 1055511498
mas "Diptic", id: 526546615
# mas "Evernote", id: 406056744
mas "EtreCheck", id: 1423715984
mas "Exporter", id: 1099120373      # Export Apple Notes to Markdown
mas "Feedly", id: 865500966
mas "Gapplin", id: 768053424
mas "Giphy Capture", id: 668208984
mas "iMovie", id: 408981434
mas "Keynote", id: 409183694
mas "Marked 2", id: 890031187
mas "Microsoft Excel", id: 462058435
mas "Microsoft PowerPoint", id: 462062816
mas "Microsoft Remote Desktop", id: 1295203466
mas "Microsoft Word", id: 462054704
# mas "MQTTBox", id: 1165784816     # failed
# mas "Numbers", id: 409203825
# mas "Pages", id: 409201541
mas "Pixelmator", id: 407963104
mas "Pocket", id: 568494494
mas "PopClip", id: 445189367
mas "Reeder", id: 880001334
mas "Skitch", id: 425955336
mas "Slack", id: 803453959
# mas "Sleep Pillow", id: 597419160
mas "Telegram", id: 747648890
mas "Textual IRC Client", id: 896450579
mas "The Unarchiver", id: 425424353
mas "TNEF's Enough", id: 986621173
mas "Trello", id: 1278508951
mas "TweetDeck", id: 485812721
mas "VOX", id: 461369673
mas "Wire", id: 931134707
mas "WireGuard", id: 1451685025
mas "Xcode", id: 497799835

Configure with dotfiles

Read and modify the file macos to your preferences and set the configuration.

source macos

Install Settings Sync extension in VSCodium

Install the Shan Khan’s Settings Sync extension.

Synchronize your settings from your Gist.

Restore application settings with Mackup

Mackup is a tool to backup and restore configuration-settings from different applications.

Create Mackup Config file

By default, Mackup syncs all application data via Dropbox, but may be configured to exclude applications or use a different backend with a .mackup.cfg file. Create a file with the name ~/.mackup.cfg with the following content:

[storage]
engine = icloud

Restore application settings

mackup restore

NOTE: I did ran into some issues with my configuration of zsh and oh-my-zsh and de the Powerlevel10k theme. I need to investigate this in a bit more detail. In the meantime be aware of possible issues.

Remaining configurations

PopClip

Add PopClip extensions:

  • Copy Markdown
  • Lowercase
  • Notes
  • Underscore

Wireguard

Use the “Import tunnel(s) from file” option to restore you Wireguard tunnels.

Remaining applications

Calibre

Download Calibre, install and configure.

Restore SSH-keys

Alternative scenario is to store your ssh-keys in your keychain.

iTerm configuration

iTerm colorscheme

GitHub - MartinSeeler/iterm2-material-design: A theme / color scheme for iTerm2 based on Google’s Material Design Color Palette material-design-colors.itermcolors

iTerm natural text selection

Enable word jumps and word deletion, aka natural text selection

By default, word jumps (option + → or ←) and word deletions (option + backspace) do not work. To enable these, go to “iTerm → Preferences → Profiles → Keys → Load Preset… → Natural Text Editing → Boom! Head explodes”

iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS) · GitHub

Install “Open in VSCodium”

Daily used finder-“shortcut” to open a selected file or directory in VSCodium. More infromation in this blogpost

Bitwarden browser extensions

Install the browser extensions for Chrome and Firefox.

Enable the Bitwarden extension in Safari. Open Safari, open the Preferences, goto Extensions and enable the Bitwarden extension.

Install Synology Drive Client

Download the installer from the Synology Download Center.