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 whypython3 -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
selectTerminal
- Quit terminal and reopen before continuing
- This is to allow the
- 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
Ooh, I didn't know you could pre-install Rosetta. For the foreseeable future, I'll have to do that on new installs.