I use Mac Primer to automatically set up my Mac. Feel free to use this as a base for your own setup.
Use this one-liner to install everything (apps
, dotfiles
, preferences
, dock
, and hosts
). This does a lot, so you should customize everything prior to running any installers.
git clone https://github.com/barryanders/mac-primer.git ~/ && ~//primer.sh
After installing, I use the update
command to update everything.
If you don't want to use the one-liner, you can pick and choose from the sections below.
apps
: Lists of installable packagesdotfiles
: Shell commands and configurationspreferences
: Presets for system preferencesdock
: Customize your Dockhosts
: Track your hosts
To install my apps, I use brewfile
(an installable list of apps generated by and for Homebrew). I rely almost exclusively on Homebrew to manage and update my apps. Learn how to make your own brewfile.
Run this script to install the packages listed in the apps folder.
~//apps/install.sh
If you want to update your apps only, use the update brew
command.
To customize my command line experience, I keep a set of configurations known as dotfiles.
The dotfiles installer requires GNU Stow (brew install stow
). Run this script to install dotfiles.
~//dotfiles/install.sh
After installing, the dotfiles in ~//dotfiles
have links in the home directory. You may need to start a new CLI session for your changes to take effect (I use the reload
command). As you add or remove files, simply rerun the installer to sync your changes. Dead links get removed and new links get added. I use the update dotfiles
command to relink mine.
The .commands
folder is intended for you to add and remove custom commands in a categorical way. Keep what you want. Refer to the template
file for a basic example of how to create your own commands.
Here's what I've got in there for you:
$
: Reasonable Terminal defaultsclean
: System maintenancedock
: Control your Dockdownload
: Download links, music, and videosfinder
: View files, get info, perform actions, extract, compress, etc.images
: Batch resizing imagesmac
: A CLI for macOS - ex. Spotlight, Wi-Fi, Gatekeepernetwork
: Get IP addresses and flush your dnsringtone
: Turn any mp3 into a ringtone for your phonetext
: Format text and encode/decode in base64, binary, hex, md5, and sha1update
: Update all the thingsvideo
: Remux, encode, or merge videos
Append to the $PATH
. Here's an example .path
file.
export PATH="/opt/homebrew/bin:$PATH"
Add private code that you don't want to commit to a public repository. My .private
file looks something like this.
# Git credentials
# Not in the repository, to prevent people from accidentally committing under my name
# https://help.github.com/articles/generating-a-gpg-key/
# Use "gpg --full-generate-key" for a full featured key generation dialog
GIT_AUTHOR_NAME="Username"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
git config --global user.name "$GIT_AUTHOR_NAME"
GIT_AUTHOR_EMAIL="username@users.noreply.github.com"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
git config --global user.email "$GIT_AUTHOR_EMAIL"
# Use "gpg --list-secret-keys --keyid-format LONG" to find the signing key
# For users with 2 factor authentication enabled: if git asks you to sign in, use an access token as your password
# Get an access token here: https://github.com/settings/tokens
GIT_SIGNING_KEY="starwarsissocool"
git config --global user.signingkey "$GIT_SIGNING_KEY"
There are some other dotfiles included like .hushlogin
, .wgetrc
, and .gitconfig
.
Use preferences
to make adjustments you would otherwise set in the System Preferences app. Define this file and reuse it whenever you like. If your settings ever get messed up, this is a great way to restore them.
~//preferences
Customize your Dock with the dock
file. Use these commands:
dock add "Terminal"
: Add an application to the macOS Dockdock add:spacer
: Adds an empty space to macOS Dockdock clear
: Removes all persistent icons from macOS Dockdock reset
: Reset macOS Dock to default settings
Once you're done, run the dock
file and your Dock will be updated accordingly.
~//dock
Keep track of your hosts in the hosts
file. I use update hosts
to replace my system hosts file with this one.
Barry Anders