Skip to content

Automatic setup for your Mac

License

Notifications You must be signed in to change notification settings

barryanders/mac-primer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mac Primer

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.

Index

If you don't want to use the one-liner, you can pick and choose from the sections below.

  • apps: Lists of installable packages
  • dotfiles: Shell commands and configurations
  • preferences: Presets for system preferences
  • dock: Customize your Dock
  • hosts: 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.

Install Apps

Run this script to install the packages listed in the apps folder.

~//apps/install.sh

Update Apps

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.

Install Dotfiles

The dotfiles installer requires GNU Stow (brew install stow). Run this script to install dotfiles.

~//dotfiles/install.sh

Update Dotfiles

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.

Customize Dotfiles

.commands Folder

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 defaults
  • clean: System maintenance
  • dock: Control your Dock
  • download: Download links, music, and videos
  • finder: View files, get info, perform actions, extract, compress, etc.
  • images: Batch resizing images
  • mac: A CLI for macOS - ex. Spotlight, Wi-Fi, Gatekeeper
  • network: Get IP addresses and flush your dns
  • ringtone: Turn any mp3 into a ringtone for your phone
  • text: Format text and encode/decode in base64, binary, hex, md5, and sha1
  • update: Update all the things
  • video: Remux, encode, or merge videos

.path File

Append to the $PATH. Here's an example .path file.

export PATH="/opt/homebrew/bin:$PATH"

.private File

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"

Other Dotfiles

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 Dock
  • dock add:spacer: Adds an empty space to macOS Dock
  • dock clear: Removes all persistent icons from macOS Dock
  • dock 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.

Author

Barry Anders
Barry Anders