My personal dotfiles and macOS setup scripts.
This script's main purpose is to quickly and automatically configure a brand-new Mac.
While it performs basic checks (e.g., whether something is already installed), it's intended for use on a clean system. It assumes the user:
- Has
sudoaccess - Is not behind a proxy
- Is not restricted by MDM or corporate policies
⚠️ It likely won’t work on corporate-managed machines.
Once you’re past the initial macOS setup screens:
-
Open Safari and go to
github.com/LuisGL100/dotfiles -
Open Terminal and run one of the following commands:
Option A: Run script immediately
curl -fsSL "https://raw.githubusercontent.com/LuisGL100/dotfiles/refs/heads/main/install.sh" | source /dev/stdin 0
Option B: Download script first
curl -fsSL "https://raw.githubusercontent.com/LuisGL100/dotfiles/refs/heads/main/install.sh" -o mac_setup.shThen, when ready:
caffeinate zsh mac_setup.sh
-
Enter your password when prompted (for
sudo). This is required only once, to install Homebrew. -
When the script completes, it will automatically quit the Terminal.
-
Re-launch the Terminal,
and follow the prompts to finish setting up Powerlevel10k (P10k)(this is now automated 🎉). -
Done 🎉
Since this script is designed for new machines, testing changes can be tricky. Thankfully, the Virtualization Framework (Apple Silicon only) makes it possible to run macOS in a virtual machine (1).
Apple provides a fully working sample project for this. You don’t need to modify the code, but understanding the process and the generated artifacts is important (2).
For a deeper explanation, watch this WWDC video.
-
Clone and open the sample app. Run any of the
InstallationTool-Xschemes and wait patiently—it can take a while.This will:
- Download the macOS restore image (
*.ipsw, ~20GB) - Install that image into a new VM, producing a
VM.bundle
- Download the macOS restore image (
-
Once installation is complete, run any of the
macOSVirtualMachineSampleApp-Xschemes. This boots the VM and shows macOS setup screens. -
Complete the setup process in the VM. Then from the app’s menu bar, select:
macOSVirtualMachineSampleApp→Save and quit macOSVirtualMachineSampleApp -
Create a backup of this "pristine" state so you can quickly and easily reset the VM later:
cp -r ~/VM.bundle ~/VMPristine.bundle
VM.bundle: your working VMVMPristine.bundle: your clean snapshot
-
Now you can modify and run your setup script inside the VM.
-
To reset the VM back to the "pristine" state:
rm -Rf ~/VM.bundle cp -r ~/VMPristine.bundle ~/VM.bundle
-
If anything happens to the "pristine" copy, you can always create another one by re-running any of the
InstallationTool-Xschemes. If you still happen to have the*.ipswdownloaded in Step 1, add its path to the Scheme's "Arguments passed on launch" in the "Run" step, to avoid downloading it again. The default path should be$(HOME)/RestoreImage.ipsw, unless you changed it.
- There are also other testing options available.
- Requires an Apple Developer account.