Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created July 29, 2012 13:33
Show Gist options
  • Save cowboy/3198819 to your computer and use it in GitHub Desktop.
Save cowboy/3198819 to your computer and use it in GitHub Desktop.
bash: Create a 10.8 "USB Install Stick" from InstallESD.dmg
#!/bin/bash
# Before running this script, open Disk Utility.
#
# Partition USB Stick:
# * 1 Partition
# * Options -> GUID Partition Table
# * Mac OS Extended (Journaled)
# * Name: Foobar
#
# When that's done, run this script from wherever InstallESD.dmg lives with:
#
# sudo bash -c "$(curl -fsSL https://raw.github.com/gist/3198819/create_108_usb_install.sh)"
# Restore image
asr -restore -source InstallESD.dmg -target /Volumes/Foobar -erase -format HFS+
# Rename drive
diskutil rename "Mac OS X Install ESD" "Mac OS X 10.8 Install"
# Give it the proper boot screen label and keep the folder from auto-opening
bless --folder "/Volumes/Mac OS X 10.8 Install" -label "Mac OS X 10.8 Install"
# Add a drive icon (note: 1024x1024 icons don't appear in the boot screen on older macs)
cp "/Volumes/Mac OS X 10.8 Install/Install OS X Mountain Lion.app/Contents/Resources/InstallAssistant.icns" "/Volumes/Mac OS X 10.8 Install/.VolumeIcon.icns"
# Set some props to ensure the icon works
SetFile -c icnC "/Volumes/Mac OS X 10.8 Install/.VolumeIcon.icns"
SetFile -a C "/Volumes/Mac OS X 10.8 Install"
@cowboy
Copy link
Author

cowboy commented Aug 2, 2012

I fleshed it out a lot more and it's in my dotfiles as create_osx_installer.

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