Skip to content

Instantly share code, notes, and snippets.

@matthewcosgrove
Last active February 7, 2021 14:24
Show Gist options
  • Save matthewcosgrove/1c426844e98b7092f655a7ceb361a58f to your computer and use it in GitHub Desktop.
Save matthewcosgrove/1c426844e98b7092f655a7ceb361a58f to your computer and use it in GitHub Desktop.
Updated for Catalina and mainly for Music Sequencing https://github.com/matthewcosgrove/macos-bootstrap
#!/bin/bash
# STEP 1: Mount bootable USB and clean up disks
# IMPORTANT: Catalina now introduces a different approach to Disks/Volumes: https://eclecticlight.co/2019/12/17/how-clean-re-installs-change-in-catalina/
# Erase everything for a proper clean install and then create a new GUID Partition Apple_APFS volume (equivalent to https://www.youtube.com/watch?v=PqfqcwmHowc&ab_channel=AjudaAqui)
# Can all be done through Disk Utility rather than terminal diskutil. You just need to create at least one volume otherwise the installer will not see the disk
# STEP 2: Install Catalina from bootable USB
# STEP 3: Download this gist from UI of GitHub "Download Zip
# mkdir "${HOME}"/bootstrap
# Copy the contents from unzipped folder into "${HOME}"/bootstrap
# STEP 4: Run this script
# USAGE: "${HOME}"/bootstrap/01_install_steps.sh
# WARNING: While the script runs, the ansible modules will cause pop-ups to requesting you to install the pre-requisite command line tools
# The following passwords are required during the script running
# BECOME password ---> Required by Ansible for installing and configuring MacOS and is the local macos account password
# mas_password ---> Required by Ansible for using the AppStore and is the password for your Apple ID
# the local MacOS password will be required at various stages while the script is running so needs to be monitored
set -euo pipefail
: "${APPLE_USER_EMAIL:? APPLE_USER_EMAIL must be set to your account for Apple for the mas module e.g. APPLE_USER_EMAIL=matthewmojuba@gmail.com. NOTE: The password for this Apple ID will need to be passed in when Ansible requests the mas_password }"
curl https://bootstrap.pypa.io/2.7/get-pip.py | python
python -m pip install --user ansible
echo 'export PATH="${HOME}/Library/Python/2.7/bin:${PATH}"' > "${HOME}"/.zshrc
source "${HOME}"/.zshrc
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ansible-galaxy install -r "${SCRIPT_DIR}"/requirements.yml
ansible-playbook --extra-vars "apple_email=${APPLE_USER_EMAIL}" "${SCRIPT_DIR}"/main.yml -i "${SCRIPT_DIR}"/inventory -K --ask-become-pass
# While script is running open each app as installed to configure (i.e. Deal with pops ups to give permission for Apps to be opened, login etc)
# AFTER SCRIPT COMPLETES..
# INSTALL ROLAND DRIVERS
# .pkg files with README files are in Dropbox
# CONFIGURE DOCK
# See 02_configure_dock.sh
# OTHER INSTALLATIONS:
# NOTE: Now added ffmpeg to list for brew install, but not yet tested that as a replacement for setting up Audacity
# Install ffmpeg 64bit: https://lame.buanzo.org/#lameosx64bitdl
# e.g. https://lame.buanzo.org/ffmpeg_64bit_osx.pkg
# This will install the ffmpeg.55.64bit.dylib file in the system library at /Library/Application Support/audacity/libs/.
# On some Macs the process may look as though it has stalled on "Validating packages" - just be patient and wait for it to complete.
# Install Audacity >2.3.1 64bit: https://www.audacityteam.org/download/mac/
# Adobe Bridge for FILE MANAGEMENT - VIDEO etc
# https://helpx.adobe.com/uk/bridge/get-started.html
#!/bin/bash
set -euo pipefail
defaults write com.apple.dock largesize -int 50 # SysPref > Dock > Magnification slider
defaults write com.apple.dock tilesize -int 32 # SysPref > Dock > Size slider
defaults write com.apple.dock magnification -bool true
dockutil --remove all
dockutil --add "/Applications/Google Chrome.app"
dockutil --add "/Applications/Logic Pro X.app"
dockutil --add /Applications/LadioCast.app
dockutil --add /Applications/Evernote.app
[defaults]
roles_path = ./roles:/etc/ansible/roles
[localhost]
127.0.0.1
---
- hosts: all
connection: local
vars_files:
- "vars.yml"
roles:
- geerlingguy.homebrew
- name: geerlingguy.mas
when: app_store_enabled
tasks:
- name: Ensure Ansible downloads directory exists.
file:
path: "{{ downloads }}"
state: directory
- name: Ensure /etc/ansible directory exists.
file:
path: /etc/ansible
state: directory
become: yes
- name: Symlink /usr/local/etc/ansible to /etc/ansible.
file:
src: /etc/ansible
path: /usr/local/etc/ansible
state: link
vars_prompt:
- name: "mas_password"
prompt: "what is your mas_password?"
---
- name: geerlingguy.homebrew
- name: geerlingguy.mas
---
downloads: ~/.ansible-downloads/
configure_sudoers: yes
app_store_enabled: true
# Homebrew set up (Defaults: https://github.com/geerlingguy/ansible-role-homebrew/blob/master/defaults/main.yml)
homebrew_installed_packages:
- git
- openssl
- ssh-copy-id
- wget
- jq
- bash
- bash-completion@2
- tree
- youtube-dl
- dockutil
- logitech-options
- ffmpeg
homebrew_taps:
- homebrew/core
- homebrew/cask-versions
- homebrew/cask-drivers # for logitech
homebrew_cask_appdir: /Applications
homebrew_cask_apps:
- 1password
- google-chrome
- evernote
- spectacle
- dropbox
- firefox
- 1password-cli
- spotify
- slack
- istat-menus5
- cyberduck
- anki
- zoom
- vlc
- handbrake
- tableplus
- imazing
- blackhole-16ch # soundflower replacement https://github.com/ExistentialAudio/BlackHole
mas_installed_apps:
- { id: 411643860, name: "DaisyDisk" }
- { id: 634148309, name: "Logic Pro" }
- { id: 411213048, name: "LadioCast" }
# find more IDs via Terminal "mas search someapp"
mas_email: "{{ apple_email }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment