Created
July 29, 2012 13:33
-
-
Save cowboy/3198819 to your computer and use it in GitHub Desktop.
bash: Create a 10.8 "USB Install Stick" from InstallESD.dmg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Maybe that's better!
This is awesome.
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
Why not just curl pipe it?
curl -fsSL https://raw.github.com/gist/3198819/create_108_usb_install.sh | sudo sh