Dotfiles & Auto Provisioner

A ruby script that automatically bootstraps a new machine with all my settings, configurations, dotfiles, and more.
dotfiles
Ruby
Dotfiles

The Problem

I'm obsessed with efficiency when it comes to my development environment. I love tweaking my vimrc, finding new packages online, or writing small utility scripts so that I can work faster. Even the delay between key presses is important to me. At this point, I've customized most things on my computer to suit my needs.
When I started a new job, I was given a brand new Macbook. As excited as I was to be rocking new hardware, it quickly dawned on me the extensive road I had ahead of me to get it up and running. So many binaries to install and so many config files to copy! Furthermore, even when I got my work computer up and running, it would be different from my personal computer. If I ever wanted to work on something on both computers, there would likely be environment issues.

The Idea

The tool junkie in me got an itch, and I set out to solve this problem. My goal was to automate the bootstrapping of a new dev machine with all my binaries, utility scripts, config files, computer settings, and so forth.

Step 1: Install System Level Packages

First, it installs all my Homebrew kegs, such as:
  • ZSH
  • FZF
  • Tmux/DIY
  • Git
  • Neovim
  • Yarn
Then it installs all my Homebrew casks, such as:
  • iTerm2
  • Chrome
  • Slack
  • 1Password
  • Docker

Step 2: Install Programming Languages

I use Ruby as my primary programming language. While OSX comes with a default Ruby installation, it's usually far behind the current stable version. To bypass this, I use Chruby and ruby-install to install the latest stable version of Ruby and set it as my default Ruby system-wide.

Step 3: Install Language Specific Packages

At this point, I have Ruby and Node installed. The script then installs any Ruby Gems or NPM packages.

Step 4: Configure ZSH

At this stage, I've already installed ZSH via Homebrew. The next step is to install Oh-My-ZSH, and configure ZSH to be my default shell.

Step 5: Symlink Dotfiles

One of the best parts of this project was migrating all my different dotfiles, such as my vimrc or zshrc, to a single, version-controlled repository. However, these dotfiles have to live in the right directories to take effect. At this stage, the script symlinks the files to their correct locations. Some examples...
  • Symlink my zshrc to my root directory.
  • Symlink my gitconfig to my root directory.
  • Symlink my tmux config to my root directory.
  • Symlink my gitconfig to my root directory.
  • Create the correct directory structure for my vimrc and colorschemes and symlink them.

Step 6: Install Vim Plugins

At this stage, I have Neovim installed. However, none of the plugins referenced in my vimrc have been installed. This stage installs all those plugins, so I have a fully functioning code editor.

Step 7: Miscellaneous

The last step does a variety of miscellaneous tasks. Some examples include:
  • Enabling italics in Neovim.
  • Setting the OSX Dock to be hidden by default.
  • Setting my wallpaper images and specifying how frequently to transition through them.
  • Setting a screenshot directory so that screenshots don't clutter my Desktop.
  • Enabling certain applications to start on boot.

Step 8: Manual Labor UGH!

At this stage, the automated process has been completed. There are still certain steps that I need to take to finish bootstrapping my computer that either cannot be automated, or I was too lazy to automate. Some examples include...
  • Create new SSH keys for Github.
  • Configure hotkeys for certain applications.
  • Modify the default directories in Finder.
  • Create Github API tokens and store them locally.
© 2022 Codemang