Skip to content

Instantly share code, notes, and snippets.

@andrewodri
Last active November 16, 2023 06:53
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save andrewodri/15dc6c9d6c7a14a686ef772516df2293 to your computer and use it in GitHub Desktop.
Save andrewodri/15dc6c9d6c7a14a686ef772516df2293 to your computer and use it in GitHub Desktop.
Download specific macOS version and create USB installer from the CLI

I always seem to forget how to download the macOS version I need by the time I need it again, so here is a quick and nasty guide on how to download a properly signed *.dmg file to build a USB installer.

If you don't want to download the tool or monkey around with permissions, give this a shot: (Provided you are dumb enough to pipe unknown code off the internet in sudo python of course):

  • sudo curl -s https://raw.githubusercontent.com/grahampugh/macadmin-scripts/master/installinstallmacos.py | sudo python - --help

If you're downloading an installer for your current machine, do the following:

  1. Run sudo curl -s https://raw.githubusercontent.com/grahampugh/macadmin-scripts/master/installinstallmacos.py | sudo python - --list
  2. Copy the build number of the macOS version you want to download
  3. Run sudo curl -s https://raw.githubusercontent.com/grahampugh/macadmin-scripts/master/installinstallmacos.py | sudo python - --workdir ~/Downloads --build build_version
  4. Open your Downloads directory after the download is complete, and you should be in business

To create a bootable USB installer, do the following:

  1. Plug in the USB drive you want to use as the installer
  2. Run ls -la /Volumes
  3. Copy the full path to the mounted USB volume (e.g. /Volumes/Untitled)
  4. Run /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /path/to/mounted/volume
  5. Accept all the prompts, wait a long time, and you're done
@andrewodri
Copy link
Author

andrewodri commented Nov 12, 2020

Here is a one-liner for downloading a macOS Big Sur disk image to your Downloads folder: sudo curl -s https://raw.githubusercontent.com/grahampugh/macadmin-scripts/master/installinstallmacos.py | sudo python - --workdir ~/Downloads --os 11.0

@opsquid
Copy link

opsquid commented Dec 12, 2022

Is there a resume command for this script? I've lost my connection while downloading the build.

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