Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@aussielunix
Last active July 29, 2023 21:32
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aussielunix/fb1ef2d906183604e3268aa86353bcb3 to your computer and use it in GitHub Desktop.
Save aussielunix/fb1ef2d906183604e3268aa86353bcb3 to your computer and use it in GitHub Desktop.
Runsheet for bootstrapping a clean MacOS M1 using https://github.com/geerlingguy/mac-dev-playbook

Day 0 - Bootstrap MacOS with Ansible

After factory resetting the maching you will need to do the following things to bootstrap it with Ansible.

  • Set default shell to bash chsh -s /bin/bash (optional)
  • Open the App Store and sign in (but do not install anything)
  • Install command line tools
    • xcode-select --install
  • Add Python 3.8 to the $PATH
    • export PATH="$HOME/Library/Python/3.8/bin:$PATH"
  • Upgrade python's pip
    • sudo pip3 install --upgrade pip
  • Install libyaml See Jeff Geerling's Post as to why
    • python3 -m pip install --user libyaml
  • Install Ansible
    • python3 -m pip install --user ansible
  • Setup ssh keys
    • airdrop ssh key pair from working MacBook
    • mkdir ~/.ssh
    • mv ~/Downloads/id_rsa* ~/.ssh/
    • chmod 0400 ~/.ssh/id_rsa
    • chmod 0644 ~/.ssh/id_rsa.pub
    • chmod 0700 ~/.ssh
    • ssh-add
  • Clone (or your fork of) https://github.com/geerlingguy/mac-dev-playbook to laptop
    • git clone git@github.com:geerlinguuy/mac-dev-playbook.git ~/.macup
  • airdrop your custom config.yml into ~/.macup/ on your new laptop
  • Install roles and collections
    • cd ~/.macup && ansible-galaxy install -r requirements.yml
  • Some things on an M1 Mac will fail due to not having Rosetta 2.
    • Install Rosetta 2
    • sudo softwareupdate --install-rosetta
  • Grant "full disk access" permissions to terminal to be allowed to change settings etc
    • This is to allow the .osx file to make changes
    • In System Preferences --> Privacy --> Full Disk Access select Terminal
    • Quit terminal and reopen before continuing
  • Create an alias for conveniently running Ansible with this specific config.
    • alias macup='ANSIBLE_CONFIG=~/.macup/ansible.cfg ansible-playbook -i ~/.macup/inventory ~/.macup/main.yml -K'
  • Configure laptop
    • macup

Day 1 plus - Maintaining MacOS with Ansible

Why

To lower the time to being productive on a new MacOS install.

How

There is two locations you should make changes that work with this automation. Tune the settings in ~/.macup/config.yml or your .osx file which this automation can run for you.

After a change is made to either, run macup. That is it.

@geerlingguy
Copy link

Ooh, I didn't know you could pre-install Rosetta. For the foreseeable future, I'll have to do that on new installs.

@benjaminmetzler
Copy link

benjaminmetzler commented Jun 16, 2021

Great document. I think you need a cd .macup before installing the requirements.txt.

@aussielunix
Copy link
Author

aussielunix commented Jun 16, 2021

Great document. I think you need a cd .macup before installing the requirements.txt.

Updated. Thanks @benjaminmetzler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment