Automate the bootstrapping of your new computer

Why automate your configuration

In automating your shell's configuration, you save yourself time each time you get access to a new computer. That is the primary value proposition of automation! No more spending 2-3 hours setting things up. Instead, simply type ./ at the terminal!

How to create a bootstrap script

The best way I would recommend doing this is by creating a dotfiles repository. (see: Leverage dotfiles to get your machine configured quickly) Place every file needed for shell initialization inside there -- primarily, I mean the .zshrc or .bashrc/.bash_profile files, and any other files on which you depend.

Then, create the main script, which you execute from within the dotfiles repository, and have it perform all of the necessary actions to place the right files in the right place. (Or symlink them from the dotfiles repository to the correct places.)

Keep in mind, there's no "perfect" setup except for the one that matches your brain. (We are, after all, talking about setting up your own computer.) Sophistication is also not a pre-requisite. All you need is to guarantee that your setup ends up working the way you'd like.

Configure your machine

After getting access to your development machine, you'll want to configure it and take full control over how it works. Backing the following steps are a core set of ideas:

  • Give yourself a rich set of commonly necessary tooling right from the beginning, but without the bloat that might be unnecessary.
  • Standardize your compute environment for maximal portability from computer to computer.
  • Build up automation to get you up and running as fast as possible.
  • Have full control over your system, such that you know as much about your configuration as possible.
  • Squeeze as much productivity out of your UI as possible.

Head over to the following pages to see how you can get things going.

Initial setup

Getting Anaconda Python installed

Master the shell

Further configuration

Leverage dotfiles to get your machine configured quickly

Why create a dotfiles repository

Your dotfiles control the baseline of your computing environment. Creating a dotfiles repository lets you version control it, make a backup of it on a hosted version control site (like Github or Bitbucket) and quickly deploy it to a new system.

How do you structure a dotfiles repository

It's really up to you, but you want to make sure that you capture all of the .some_file_extension files stored in your home directory that are also important for your shell runtime environment.

For example, you might want to include your .zshrc or your .bashrc files, i.e. the shell initialization scripts.

You might also want to refactor out some pieces from the .zshrc and put them into separate files that get sourced inside those files. For example, I have two, one for the PATH environment variable named .path (see: Take full control of your shell environment variables) and one for aliases named .aliases (see: Create shell command aliases for your commonly used commands). You can source these files in the .zshrc file, so I have everything defined in .path and .aliases available to me.

You can also create an script that, when executed at the shell, symlinks all the files from the dotfiles directory into the home directory or copies them. (I usually opt to symlink because I can apply updates more easily.) The script can be as simple as:

cp .zshrc $HOME/.zshrc
cp .path $HOME/.path
cp .aliases $HOME/.aliases

Everything outlined above forms the basis of your bootstrap for a new computer, which I alluded to in Automate the bootstrapping of your new computer.

If you want to see a few examples of dotfiles in action, check out the following repositories and pages:

From the official "dotfiles" GitHub pages:

My own dotfiles: ericmjl/dotfiles which are inspired by mathiasbynens/dotfiles