heff / dotfiles

Setup your Mac and sync it with your other machines.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dotfiles

Setup and sync your Mac system in the quickest way possible.

Overview

This dotfiles project is a combination of some shell scripts and configuration files. The shell scripts automate setup and installation of dev tools, apps, symlinks, and other things. The "dotfiles" are simply local configuration files that we're moving to Dropbox in order to sync multiple systems to the same configuration.

Why?

New computers are hard to setup without automation and keeping all of your machines in sync is painful. A system like this solves it all.

How It Works

It's pretty straightforward. This system:

  • Runs a shell script that automates the installations of command line tools, package managers, and Mac applications.
  • Runs a shell script that automates your MacOS preferences.
  • Symlinks your shell configurations, git configs and any other configs to Dropbox, allowing all of your machines to sync up to the same configuration.
  • Symlinks application configurations using Mackup.
  • Allows you to separate your personal and work configurations to keep things organized.

** Note: Mackup can automate your entire system for you, but I chose not to use that because it's hard to keep track of what Mackup is doing. Instead, I only use Mackup to sync apps that do not support native Dropbox sync.

Folder Structure

I store this repo in Dropbox, in a folder named _config. I also keep 2 more folders in here that are not open source, my dotfiles-work folder, and my appdata folder. dotfiles-work contains additional bash configurations that I use on my work machine. appdata stores my application configurations.

My entire configuration folder looks something like this:

_config/
├── README.md
├── appdata
│   ├── 1password
│   ├── Alfred
│   ├── iTerm
│   └── Mackup
├── dotfiles
│   ├── scripts
│   │   ├──  bootstrap
│   │   ├──  setup_mac
│   │   └──  setup_symlinks
│   ├── aliases
│   ├── gitconfig
│   ├── gitconfig.personal
│   ├── intro
│   └── mackup.cfg
│   └── zshrc
└── dotfiles-work
    ├── scripts
    │   └──  setup_symlinks
    ├── aliases.work
    └── gitconfig.work

Setup scripts

  • bootstrap - Install and configure packages managed by Homebrew, Yarn/NPM, Homebrew Cask, Mac App Store.
  • setup_mac - Set your macOS defaults. Reboot required.
  • setup_symlinks - Symlinks local config files to your Dropbox config folder.

Initial Setup

Since we're setting up our system to sync to Dropbox, the first thing you want to do on your brand new Mac is download and install the Dropbox app.

Setup Dropbox for Selective Sync

After downloading, installing, and logging in to Dropbox, we need to immediately setup Selective Sync to avoid pulling down our entire Dropbox yet. I use a _config folder in my Dropbox folder to store all of my configuration files, so I'll do the following:

  • Go to Dropbox Preferences
  • Select the Account tab
  • Select the "Change Settings" button next to "Selective Sync"
  • Select only the _config folder
  • Wait for sync to finish

Setup

Now we're ready to run our setup scripts. Open up Terminal then head over to your config folder.

cd ~/Dropbox/_config/dotfiles/scripts

Then run your setup scripts. If this is your first time setting up dotfiles, you'll probably have to run chmod +x on your files to make them executable. Otherwise you can just run them as is. I normally run these scripts one by one to ensure things are going smoothly.

./bootstrap

./setup_mac

./setup_symlinks

Note: Before moving forward, see App-specific setup notes below. Some apps require specific setup options that can't be automated.

Using Github instead of Dropbox

I use Github as a backup, reference, and place to share this repo. My latest configuration always stays here and I can easily pull down this repo and setup my machine. The benefit of Dropbox is the real time syncing. So when I make edits to my configuration, my other systems are being updated in real time due to the Dropbox. When I'm finished I push my edits to this repo for safe keeping. If you do not wish to use Dropbox, you can keep the exact same folder structure and use git to manage your config in a repo. To sync, you'd simply need to push/pull your updates as you make them.

About

Setup your Mac and sync it with your other machines.


Languages

Language:Shell 100.0%