These are the scripts that I use to setup and maintain my Mac forked from Jason's repo.
Thank you Jason!
As you can see, heavily depend on 🍺 Homebrew
- My Mac Setup
On a new machine or fresh macOS install: before you can do much on the command line (like using Git), Xcode Command Line Tools need to be installed and the license agreed to.
- Open Applications > Utilites > Terminal
- Install Xcode Command Line Tools
xcode-select --install - Click install, agree to license
You can clone the repository wherever you want. I like to keep it in ~/Documents/Projects/my-mac-setup.
git clone https://github.com/pablordoricaw/my-mac-setup.git && cd my-mac-setupThe setup supports profiles so a different set of configurations and applications gets installed depending on the machine. Two profiles ship by default:
personal— installs everything (the default).work— installs a selected subset (e.g. skips Docker).
A profile is two things:
- A manifest (
profiles/<profile>.txt) listing which scripts run, in order. - Per-profile app lists layered on top of shared
*.commonlists:- Homebrew:
homebrew/formulae.<profile>andhomebrew/casks.<profile> - App Store:
macos/mas.<profile> - Dock:
macos/dock.<profile>
- Homebrew:
Run the whole setup for a profile (from the repo root):
./installer.sh work # or: ./installer.sh personal (default if omitted)Every individual script also accepts the profile as its first argument, e.g.
source ./homebrew/install.sh work. If omitted it defaults to personal.
Add a new profile by creating profiles/<name>.txt plus the matching
*.<name> app lists (any you omit fall back to just the *.common items).
The homebrew/install.sh script will:
- Install (or update) Homebrew
- Install a list of Homebrew formulae
- Install a list of applications via Homebrew Cask
Run it: source ./homebrew/install.sh
Pre-requisites: Needs the Github CLI gh installed (it is
installed by homebrew/install.sh).
The github/config-ssh-key.sh
script will:
- Generate a new
ed25519SSH key (~/.ssh/github_id_ed25519). - Add it to the
ssh-agentand your~/.ssh/config. - Log you in to GitHub over SSH with
gh auth login --git-protocol ssh, uploading the new key to your account as part of the login. - Test the SSH connection to GitHub.
The login step is interactive: when prompted, pick how to authenticate (web browser or a
token), select the github_id_ed25519.pub key to upload, and give it a title (e.g.
user@computername). gh requests the admin:public_key scope it needs automatically.
Run it: source ./github/config-ssh-key.sh
Pre-requisites: Needs chezmoi installed and SSH key setup in your GitHub account
The dotfiles/config-dotfiles.sh will use chezmoi to clone the dotfiles repo and apply them.
Run it: source ./dotfiles/config-dotfiles.sh
Pre-requisites: Needs the .macos file from the dotfiles.
The ~/.macos file applied with chezmoi will config macOS.
Run it: source ~/.macos
Pre-requisites: (Soft) Needs applications to be installed with 🍺 Homebrew.
The macos/config-dock.sh script will clear and add specific application icons to the dock.
Run it: source ./macos/config-dock.sh
Pre-requisites: (Soft) Google Chrome and/or Firefox installed. Each browser is skipped if it isn't installed.
The browsers/config-extensions.sh
script force-installs extensions via each browser's managed-policy mechanism (Chrome's
ExtensionInstallForcelist defaults key; Firefox's policies.json). Extensions are read
from the per-profile lists in browsers/ (chrome.<profile> / firefox.<profile> layered
on *.common). Vimium is installed by default for both. Restart the browser to apply, and
note force-installed extensions appear as managed and can't be removed from within the
browser.
Run it: source ./browsers/config-extensions.sh (optionally pass a profile, e.g.
source ./browsers/config-extensions.sh work)
Pre-requisites:
- Sign in manually into the App Store.
- Needs
masinstalled. It is installed with 🍺 Homebrew
The macos/install-apps.sh script will install the App Store applications. It uses the mas CLI to do so.
To add more apps to be installed refer to the Usage section of the README of
mas
Run it: source ./macos/install.sh
Check the individual requirements. For example, Docker requires the Docker Installer to be downloaded from www.docker.com.
Run it: source ./other/install.sh
The following section contains instructions to update all the installed binaries and applications with 🍺 Homebrew and mas.
Follow the instructions outlined in the How do I update my local packages? section in the FAQ page of Homebrew 🍺.
- Close all applications installed with Homebrew.
- Open the Terminal app
- Run the following command to update all applications installed with Homebrew:
brew upgrade --cask - Once, applications are updated, run the
macos/config-doc.shscript.
Note: For more details on the brew upgrade --cask command refer to the answer by scribblemaniac to the Upgrade all the casks installed via Homebrew Cask in StackOverflow.
- Run the
macos/install-apps.shscript to update all applications installed withmas.
It is possible to uninstall the packages and aplications as well as reset the configs.
Inside the folders there are scripts that start with uninstall- or reset-. Use these files to uninstall apps and/or packages and reset configs.
To execute the scripts use the source command followed by the path to the script.
Important: Be sure to check the pre-requisites section of the section in the installation instructions, as the same pre-requisites will apply to execute these scripts.
Extensions configured with browsers/config-extensions.sh
are force-installed via managed policies, so they cannot be removed from within the
browser. Undo them as follows:
-
Chrome — delete the managed force-install list, then restart Chrome:
defaults delete com.google.Chrome ExtensionInstallForcelist
-
Firefox — delete the generated policy file, then restart Firefox (use
sudoif the file isn't writable):rm "/Applications/Firefox.app/Contents/Resources/distribution/policies.json"
To drop a single extension instead, remove its line from the matching
browsers/chrome.<profile> / browsers/firefox.<profile> (or *.common) list and re-run
source ./browsers/config-extensions.sh — the script rewrites each browser's policy from the
lists, so the removed extension is no longer force-installed.
Note: If you're looking to uninstall all packages and applications and reset all configs consider looking into Apple's docs to Erase your Mac and reset it to factory settings
brew doctor- to check in case anything went wrong while using Hombrew.brew list– list installed Homebrew formulae, including casks
This list contains things that I want this repo to setup in my Mac that I haven't done so far
- Install the ToothFairy application
- Install the Unsplash Wallpapers application
- Install the Things 3
This list contains ideas to improve this repo
- Install Command Line Tools during installation
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install- End-to-end setup of Mac with one command
- Include dependencies between the setup steps.
- A step always runs after the step(s) it depends on.
- A step doesn't run and alerts if a parent step didn't complete successfully
The following list contains the inspirations for Jason repository from when I forked his repository.