• Stars
    star
    468
  • Rank 93,767 (Top 2 %)
  • Language
    Shell
  • License
    Other
  • Created about 8 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Shell scripts for automated macOS machine setup.

macOS

Shell scripts for automated macOS machine setup.

This project is a framework for automating the setup of a macOS machine. In order to illustrate the potential of what this project can do, please see the companion macOS Config project for details. The macOS Config project is an opinionated configuration which meets the needs of my development environment but is also meant to serve as an example and guide for building your own personalized setup. Here is how the two projects are meant to be used:

  • macOS (this project) - The foundational framework for building custom macOS machine setups.

  • macOS Configuration - The layer on top of this macOS project which defines a custom machine implementation. The project is meant to be forked for as many custom machine setups as needed.

Features

  • Provides a command line interface, written in Bash, with no additional dependencies for installation and management of a macOS machine.

  • Supports macOS boot disk creation for fresh install of operating system.

  • Installs Xcode Command Line Tools.

  • Installs Homebrew formulas and casks.

  • Installs App Store software.

  • Installs non-App Store software applications.

  • Installs software application extensions.

  • Installs dotfiles.

  • Installs Node packages.

  • Installs Ruby gems.

  • Installs Rust crates.

  • Applies basic default software settings.

  • Configures installed software.

  • Supports restoration of machine backups.

Screencast

Screencast

Requirements

Setup

To install, run:

git clone https://github.com/bkuhlmann/mac_os.git
cd mac_os
git checkout 16.0.4

Usage

Run the following:

bin/run

You will be presented with the following options (listed in order of use):

Boot:
   B:  Create boot disk.
Install:
   b:  Apply basic settings.
   t:  Install development tools.
  hf:  Install Homebrew Formulas.
  hc:  Install Homebrew Casks.
   m:  Install Mac App Store software.
   a:  Install application software.
   x:  Install application software extensions.
  df:  Install dotfiles.
  np:  Install Node packages.
  rg:  Install Ruby gems.
  rc:  Install Rust crates.
   d:  Apply default settings.
  cs:  Configure installed software.
   i:  Install everything (i.e. executes all install options in order listed).
Restore:
   R:  Restore settings from backup.
Manage:
   c:  Check status of managed software.
   C:  Caffeinate machine.
  ua:  Uninstall application software.
  ux:  Uninstall application software extension.
  ra:  Reinstall application software.
  rx:  Reinstall application software extension.
   w:  Clean work (temp) directory.
   q:  Quit/Exit.

Choose option i to run a full install or select a specific option to run a single action. Each option is designed to be re-run if necessary. This can also be handy for performing upgrades, re-running a missing/failed install, etc.

The option prompt can be skipped by passing the desired option directly to the bin/run script. For example, executing bin/run i will execute the full install process.

The machine should be rebooted after all install tasks have completed to ensure all settings have been loaded.

It is recommended that the mac_os project directory not be deleted and kept on the local machine in order to manage installed software and benefit from future upgrades.

Boot Disk

When attempting to create a boot disk via bin/run B, you’ll be presented with the following documentation (provided here for reference):

macOS Boot Disk Tips
  - Use a USB drive (8GB or higher).
  - Use Disk Utility to format the USB drive as "Mac OS Extended (Journaled)".
  - Use Disk Utility to label the USB drive as "Untitled".

macOS Boot Disk Usage:
  1. Insert the USB boot disk into the machine to be upgraded.
  2. Reboot the machine.
  3. Hold the POWER (Silicon) or OPTION (Intel) key before the Apple logo appears.
  4. Select the USB boot disk from the menu.
  5. Use Disk Utility to delete and/or erase the hard drive including associated partitions.
  6. Use Disk Utility to create a single "APFS" drive as a "GUID Partition Table".
  7. Install the new operating system.

macOS Boot Disk Recovery:
  1. Start/restart the machine.
  2. Hold the POWER (Silicon) or COMMAND+R (Intel) keys before the Apple logo appears.
  3. Wait for the macOS installer to load from the recovery partition.
  4. Use the dialog options to launch Disk Utility, reinstall the system, etc.

Customization

All executable scripts can be found in the bin folder:

  • bin/apply_basic_settings (optional, customizable): Applies basic and initial settings for setting up a machine.

  • bin/apply_default_settings (optional, customizable): Applies bare minimum system and application defaults.

  • bin/configure_software (optional, customizable): Configures installed software as part of the post install process.

  • bin/create_boot_disk (optional): Creates a macOS boot disk.

  • bin/install_app_store (optional, customizable): Installs macOS, GUI-based, App Store applications.

  • bin/install_applications (optional, customizable): Installs macOS, GUI-based, non-App Store applications.

  • bin/install_dev_tools (required): Installs macOS development tools required by Homebrew.

  • bin/install_dotfiles (optional, customizable): Installs personal dotfiles so the system is tailored to your workflow.

  • bin/install_extensions (optional, customizable): Installs macOS application extensions and add-ons.

  • bin/install_homebrew_casks (optional, customizable): Installs Homebrew Formulas.

  • bin/install_homebrew_formulas (optional, customizable): Installs Homebrew Casks.

  • bin/install_node_packages (optional, customizable): Installs Node packages.

  • bin/install_ruby_gems (optional, customizable): Installs Ruby gems.

  • bin/install_rust_crates (optional, customizable): Installs Rust crates.

  • bin/restore_backup (optional, customizable): Restores system/application settings from backup image.

  • bin/run (required): The main script and interface for macOS setup.

The lib folder provides the base framework for installing, re-installing, and uninstalling software. Everything provided via the macOS Config project is built upon the functions found in the lib folder. See the macOS Config project for further details.

  • lib/settings.sh: Defines global settings for software applications, extensions, etc.

Troubleshooting

  • Pi-hole: When using Pi-hole, you might need to temporarily disable prior to upgrading as you might experience various errors with Apple not being able to detect an internet connection which prevents the installer from working.

  • Recovery Mode: When using the boot disk and the installer fails in some catastrophic manner, reboot the machine into recovery mode — POWER (Silicon) or COMMAND + r (Intel) buttons — to download and install the last operating system used. Alternatively, you can also use COMMAND
    OPTION + r (Intel) to attempt to download the latest operating system.

  • NVRAM/PRAM Reset: When using the boot disk, you might experience a situation where you see a black screen with a white circle and diagonal line running through it. This means macOS lost or can’t find the boot disk for some reason. To correct this, shut down and boot up the system again while holding down OPTION + COMMAND + r
    p (Intel) keys simultaneously. You might want to wait for the system boot sound to happen a few times before releasing the keys. This will clear the system NVRAM/PRAM. At this point you can shut down and restart the system following the boot disk instructions (the boot disk will be recognized now).

  • System Management Controller (SMC) Reset: Sometimes it can help to reset the SMC to improve system speed. To fix, follow these steps:

    • Shut down your Mac.

    • Hold down CONTROL + OPTION on the left side of the keyboard and SHIFT on the right side of the keyboard.

    • After seven seconds, hold down the Power button as well.

    • Release all keys after another seven seconds.

    • Turn on your Mac.

Development

To contribute, run:

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

Credits

Engineered by Brooke Kuhlmann.

More Repositories

1

gemsmith

A command line interface for smithing Ruby gems.
Ruby
455
star
2

mac_os-config

Shell scripts for customized macOS machine setup.
Shell
394
star
3

dotfiles

Shell scripts for applying default settings to UNIX-based operating systems.
Shell
152
star
4

versionaire

An immutable, thread-safe, and strict semantic version type.
Ruby
87
star
5

refinements

A collection of core object refinements.
Ruby
69
star
6

git-lint

A command line interface for linting Git commits.
Ruby
51
star
7

pragmater

A command line interface for managing pragma comments.
Ruby
45
star
8

xdg

A XDG Base Directory Specification implementation.
Ruby
44
star
9

tocer

A command line interface for generating Markdown table of contents.
Ruby
44
star
10

milestoner

A command line interface for automated Git repository milestones.
Ruby
37
star
11

prawn_plus

A Rails renderer for Prawn PDFs.
Ruby
31
star
12

transactable

A domain specific language for functionally composable transactional workflows.
Ruby
25
star
13

auther

A multi-account, form-based, database-less, application-wide, Rails authenticator.
Ruby
23
star
14

rubysmith

A command line interface for smithing Ruby projects.
Ruby
23
star
15

hemo

A Hanami demo application.
Ruby
23
star
16

bashsmith

A template for smithing Bash scripts.
Shell
19
star
17

runcom

A XDG enhanced run command manager for command line interfaces.
Ruby
18
star
18

pennyworth

A command line interface for augmented Alfred workflows.
Ruby
15
star
19

navigator

A Rails domain specific language for menu navigation.
Ruby
15
star
20

hanamismith

A command line interface for smithing Hanami projects.
Ruby
14
star
21

htmx

An augmenter and companion to the HTMX JavaScript library.
Ruby
14
star
22

sublime_text_setup

Shell scripts for managing settings, key bindings, extensions, code snippets, etc.
Shell
12
star
23

sod

A domain specific language for creating composable command line interfaces.
Ruby
9
star
24

archiver

Shell scripts for automated backup of UNIX-based operation systems.
Shell
8
star
25

auto_injector

Automates the injection of dependencies for your class.
Ruby
7
star
26

cogger

A customizable and feature rich logger.
Ruby
7
star
27

caliber

A global, high quality, and constantly updated RuboCop configuration.
Ruby
7
star
28

lode

A monadic store of marshaled objects.
Ruby
5
star
29

ghub

A monadic GitHub API client.
Ruby
5
star
30

marameters

A dynamic method parameter inspector.
Ruby
5
star
31

etcher

A monadic configuration loader, transformer, and validator.
Ruby
5
star
32

tana

A monadic API client for the Tana Personal Knowledge Management system.
Ruby
5
star
33

benchmarks

A collection of micro benchmarks.
Ruby
5
star
34

tone

A customizable ANSI text terminal colorizer.
Ruby
4
star
35

htmx-remove

A htmx extension for DOM element removal via click events.
Ruby
4
star
36

sublime_text_kit

A command line interface for managing Sublime Text metadata.
Ruby
3
star
37

infusible

An automatic dependency injector.
Ruby
3
star
38

irb-kit

Extends IRB by providing additional productivity enhancements.
Ruby
3
star
39

pipeable

A domain specific language for building functionally composable steps.
Ruby
3
star
40

docker-alpine-ruby

A Ruby focused Docker image with current tooling for development purposes.
Dockerfile
2
star
41

git_plus

Provides an Object API around Git.
Ruby
2
star
42

gitt

A monadic Object API for the Git CLI.
Ruby
2
star
43

wholable

A whole value object enabler.
Ruby
1
star
44

spek

Enhances gem specifications with additional information and tooling.
Ruby
1
star
45

containable

A thread-safe dependency injection container.
Ruby
1
star
46

pkce

An OAuth Proof Key for Code Exchange (PKCE) challenge and code verifier.
Ruby
1
star
47

http-fake

A HTTP fake implementation for test suites.
Ruby
1
star
48

docker-alpine-base

A base Docker image with minimal tooling for development purposes.
Dockerfile
1
star