Skip to content

Repository files navigation

dotfiles

Introduction

This repository contains a series of automated customizations that help me personalize and maintain my Mac. Special thanks to Zack Holman and Dries Vints for inspiring what you see within this repository. In many instances, what I have here is a direct copy of their work.

If you're interested in the philosophy behind why projects like these are awesome, you might want to read the following articles on the subject:

Repositories

The following repositories may provide additional examples from which to draw inspiration.

New Machine Setup

Initial Preparation

Whether migrating from an existing machine to another or setting up an additional computer that adopts your preferred setup, you will want to ensure you have a fresh backup of all your data and settings.

  • Commit and push any pending changes within local git repositories
  • Move any important documents into cloud-based storage
  • Save all of your work within apps that do not sync to the cloud
  • Update your mackup to the latest version and run mackup backup -f

Update macOS

If you are setting up a new machine, odds are macOS is already up-to-date. However, check System Settings on the new machine and install any pending updates.

App Store

We use the Mac App Store CLI to install several applications, so ensure you are logged in to the App Store.

Generate an SSH key

Via 1Password

In recent years, I've been using the 1Password SSH agent to securely store my SSH keys.

  1. Download 1Password
  2. Open 1Password
  3. Open "Settings"
  4. Select "Developer"
  5. Enable "Use the SSH Agent"
  6. Click "Change SSH Config..."
  7. Select "Edit Automatically"

Manually

If you are not a 1Password user, you can run the following command to generate a new public and private SSH key. Once complete, add the key to your GitHub profile.

curl https://raw.githubusercontent.com/dascentral/dotfiles/HEAD/ssh.sh | sh -s "<your-key-name>"

Clone this repository

All scripts within this repository assume ~/.dotfiles as the clone location. You may adjust this as you see fit. However, you will need to update all scripts accordingly.

Note that issuing your first git command will prompt installation of the Xcode Command Line Tools. Go grab a coffee/snack/meal while that download and install takes place.

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

Installation Prerequisite

Before running the main installation script, we have one prerequisite to address.

I use Homebrew Bundle to install the bulk of the software on a new machine. Before executing the main installation script, create a Brewfile at the root of the repository.

Creating this Brewfile is the one intentional manual decision required before installing. It defines exactly what software lands on the machine. install.sh runs a readiness check (scripts/check.sh) that halts the install until a Brewfile exists at the repository root.

This repository contains two sample files:

  1. Brewfile.example — The superset of software I would install on a machine
  2. Brewfile.quickstart — For getting up and running quickly

You can copy either one to get started:

cp Brewfile.example Brewfile

Installation

The following script installs and configures most of the software that I use on a new machine.

~/.dotfiles/install.sh

If you dig into that installation script, you'll note that it does a few things:

  1. Installs Oh My Zsh (unattended) along with a few Zsh plugins
  2. Installs Homebrew, the Missing Package Manager for macOS (or Linux), and executes brew bundle, which installs the bulk of the software
  3. Ensures Composer is up-to-date and installs all global packages
  4. Configures Git
  5. Configures SSH
  6. Configures Mackup
  7. Configures Cursor
  8. Configures VS Code
  9. Configures Sublime Text
  10. Customizes macOS settings
  11. Configures Claude

The script is idempotent, so it can be run multiple times without concern.

Maintenance

The bin/ folder of this repository contains a dotfiles script that executes a number of maintenance activities that keep the machine up-to-date. I try to run this script regularly. (i.e., weekly)

The .zshrc includes ~/.dotfiles/bin in the system path, so you can run this command from anywhere.

dotfiles

Optional Configurations

Gatekeeper

Gatekeeper is a security feature of macOS. Some of the software installed via the Brewfile is published by what Apple considers "unidentified developers."

You can circumvent the security feature by disabling Gatekeeper.

sudo spctl --master-disable

If you run this command, be sure to only open software from sources that you trust. You can always turn it back on after installing a restricted software application.

sudo spctl --master-enable

Command-Line Configurations

While I have automated many of my macOS system configurations via the .macos file, I still have a number of manual modifications that I make following the setup of a new machine. My goal is always to minimize manual work. This article helped me understand how to automate application settings:

https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/

Key Commands

Print all domains

defaults domains | tr ',' '\n'

Print settings for a specific app

defaults read [domain]
defaults read com.googlecode.iterm2

Print specific key

defaults read [domain] [key]
defaults read com.googlecode.iterm2 PrefsCustomFolder

Write new settings

defaults read [domain] [key] [type] [value]
defaults write com.apple.Notes NotesContinuousSpellCheckingEnabled -bool true

About

A series of customizations that help me personalize my Mac.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages