/mac_os-config

Shell scripts for customized macOS machine setup and configuration.

Primary LanguageShellApache License 2.0Apache-2.0

MacOS Config Icon

macOS Configuration

Circle CI Status

Shell scripts for customized macOS machine setup and configuration.

This project provides a highly opinionated default configuration built upon the macOS project. Should the configuration provided by this project not be to your liking, feel free to fork and customize for your specific needs.

Table of Contents

Features

Requirements

  1. macOS

Setup

Open a terminal window and execute one of the following setup sequences depending on your version preference:

Current Version (stable):

git clone https://github.com/bkuhlmann/mac_os-config.git
cd mac_os-config
git checkout 12.2.0

Master Version (unstable):

git clone https://github.com/bkuhlmann/mac_os-config.git
cd mac_os-config

Usage

The following will walk you through the steps of installing/re-installing your machine.

Pre-Install

Double check you have the following in place:

  1. A recent backup of your machine and a copy of your credentials to restore the backup.
  2. A copy of your of your Apple, backup server, and backup volume credentials.
  3. Xcode installed as per macOS requirements.

Install

See the macOS project for usage as it provides the command line interface for running the configuration defined by this project.

Post-Install

The following are additional steps, not easily automated, that are worth completing after the install scripts have been executed:

  • System Preferences:
    • Security & Privacy:
      • General:
        • Require password immediately after sleep or screen saver begins.
        • Enable message when screen is locked. Example: <url> | <email> | <phone>.
        • Allow your Apple Watch to unlock your Mac.
      • FileVault:
        • Enable FileVault and save the recovery key in a secure location (i.e. 1Password).
      • Firewall:
        • Enabled it.
        • Automatically allow signed software.
        • Enable stealth mode.
      • Privacy:
        • Apps like Dash, Dropbox, etc. will need to be enabled for accessibility.
    • Notifications:
      • Enable Do Not Disturb from 9pm to 7am.
      • Enable When display is sleeping.
      • Enable When mirroring.
      • Enable allow repeated calls.
      • Disable Show notifications on lock screen for all apps.
      • Disable Play sounds for notifications for all apps.
      • Configure all calendar apps to show banners instead of alerts for notifications.
    • Printers & Scanners:
      • Add printer/scanner.
    • iCloud:
      • Enable Find My Mac.
    • Internet Accounts:
      • Add all accounts used by Mail.
    • Network:
      • Configure Wi-Fi.
    • Users & Groups:
      • Update avatar.
      • Remove unused login items.
      • Disable guest account.
  • iStat Menus (double click, within the Applications folder, to install as a system preference).
  • Hazel (double click, within the Applications folder, to install as a system preference).

Global Hotkeys

Several applications provide global hotkey support. These are the associations I use (which are also captured in the restore.bom as well):

  • COMMAND + SPACE (hold): Siri (open)
  • COMMAND + SPACE: Spotlight (open)
  • CONTROL + OPTION + COMMAND + 1: CleanShot (capture area)
  • CONTROL + OPTION + COMMAND + 2: CleanShot (capture fullscreen)
  • CONTROL + OPTION + COMMAND + 3: CleanShot (record video)
  • CONTROL + OPTION + COMMAND + 4: Gifox (capture area)
  • CONTROL + OPTION + COMMAND + 5: Gifox (capture window)
  • CONTROL + OPTION + COMMAND + b: Bartender (hidden menu toggle)
  • CONTROL + OPTION + COMMAND + c: Sip (copy color)
  • CONTROL + OPTION + COMMAND + ENTER: Keymo (move cursor by division)
  • CONTROL + OPTION + COMMAND + k: Keymo (cursor highlight show/hide)
  • CONTROL + OPTION + COMMAND + m: Moom (show/hide)
  • CONTROL + OPTION + COMMAND + n: Notification Center (show/hide)
  • CONTROL + OPTION + COMMAND + p: PixelSnap (show/hide)
  • CONTROL + OPTION + COMMAND + r: Resolutionator (selector)
  • CONTROL + OPTION + COMMAND + s: KeyCastr (show/hide)
  • CONTROL + OPTION + COMMAND + ←: Keymo (move cursor left)
  • CONTROL + OPTION + COMMAND + ↑: Keymo (move cursor up)
  • CONTROL + OPTION + COMMAND + →: Keymo (move cursor right)
  • CONTROL + OPTION + COMMAND + ↓: Keymo (move cursor down)
  • CONTROL + OPTION + SPACE: OmniFocus (quick entry)
  • OPTION + SPACE: Alfred (open)

Newsyslog

Native to macOS, newsyslog can be used to configure system-wide log rotation across multiple projects. It's a good recommendation to set this up so that disk space is carefully maintained. Here's how to configure it for your system, start by creating a configuration for your projects in the /etc/newsyslog.d directory. In my case, I use the following configurations:

  • /etc/newsyslog.d/alchemists.conf

      # logfilename                                            [owner:group]    mode   count   size  when  flags
      /Users/bkuhlmann/Dropbox/Development/Work/**/log/*.log                    644    2       5120  *     GJN
    
  • /etc/newsyslog.d/homebrew.conf

      # logfilename                   [owner:group]    mode   count   size    when  flags
      /usr/local/var/log/**/*.log                      644    2       5120    *     GJN
    

These configurations ensure that logs are rotated every 5MB (5120KB). In order to test that these configurations are valid, run:

sudo newsyslog -nvv

If you don't see any errors in the output, then your configuration settings are correct.

The last thing to do is to add a launch configuration to ensure the log rotations happen at regularly scheduled intervals. To do this create the following file: $HOME/Library/LaunchAgents/com.apple.newsyslog.plist. It should have the following content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.apple.newsyslog</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/sbin/newsyslog</string>
  </array>
  <key>LowPriorityIO</key>
  <true/>
  <key>Nice</key>
  <integer>1</integer>
  <key>StartCalendarInterval</key>
  <dict>
    <key>Minute</key>
    <integer>30</integer>
  </dict>
</dict>
</plist>

That's it. System-wide log rotation is setup for your projects.

Customization

While this project's configuration is opinionated and tailored for my setup, you can easily fork this project and customize it for your environment. Start by editing the files found in the bin and lib directories. Here is a breakdown of each:

  • bin/apply_basic_settings: Applies basic and initial settings for setting up a machine.
  • bin/apply_default_settings: Applies useful system and application defaults.
  • bin/install_app_store: Installs macOS, GUI-based, App Store applications.
  • bin/install_applications: Installs macOS, GUI-based, non-App Store applications.
  • bin/install_extensions: Installs macOS application extensions and add-ons.
  • bin/install_homebrew_casks: Installs Homebrew Casks.
  • bin/install_homebrew_formulas: Installs Homebrew Formulas.
  • bin/restore_backup: Restores system/application settings from backup image.
  • bin/setup_software: Configures and launches (if necessary) installed software.
  • lib/settings.sh: Defines custom settings for software applications, extensions, etc.

TIP: The installer determines which applications/extensions to install as defined in the settings.sh script. Applications defined with the "APP_NAME" suffix and extensions defined with the "EXTENSION_PATH" suffix inform the installer what to care about. Removing/commenting out these applications/extensions within the settings.sh file will cause the installer to skip these applications/extensions.

Versioning

Read Semantic Versioning for details. Briefly, it means:

  • Major (X.y.z) - Incremented for any backwards incompatible public API changes.
  • Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
  • Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.

Code of Conduct

Please note that this project is released with a CODE OF CONDUCT. By participating in this project you agree to abide by its terms.

Contributions

Read CONTRIBUTING for details.

License

Copyright 2016 Alchemists. Read LICENSE for details.

History

Read CHANGES for details. Built with Bashsmith.

Credits

Developed by Brooke Kuhlmann at Alchemists.