OS X macOS Install ISO Creator
Hello, Is there any way that you can update the support for MAC OS High Sierra, And Mojave???
#!/bin/bash |
################################ |
# OS X Install ISO Creater # |
# # |
# Author: shela # |
################################ |
####################################### |
# Declarations |
####################################### |
shopt -s nocasematch |
readonly TEMP_DIR=$(mktemp -d /tmp/osx-image.XXX) |
readonly INPUT_MOUNT='${TEMP_DIR}/input_mount' |
readonly OUTPUT_MOUNT='${TEMP_DIR}/output_mount' |
readonly BUILD_MOUNT='${TEMP_DIR}/build_mount' |
readonly SPARSE_IMAGE='${TEMP_DIR}/osx.sparseimage' |
readonly DEFAULT_OUTPUT_DIR='${HOME}/Desktop' |
trap cleanup EXIT |
####################################### |
# Display information message |
####################################### |
info() { |
echo -e '033[0;32m${1}033[0m' |
} |
####################################### |
# Display error message |
####################################### |
error() { |
echo -e '033[0;31m${1}033[0;39m'>&2 |
} |
####################################### |
# Create install iso image |
####################################### |
create_image() { |
local in=${1} |
local out=${2%/} |
# Create output directory |
if [ !-d'${out}' ];then |
info 'Destination directory ${out} does not exists. Creating...' |
mkdir -p '${out}' |
if [[ $?-ne 0 ]];then |
error 'Could not create output directory.' |
exit 1 |
fi |
fi |
# Mount the installer image |
info 'Attaching $(basename '${in}')...' |
hdiutil attach '${in}' -noverify -nobrowse -mountpoint '${INPUT_MOUNT}' |
if [[ $?-ne 0 ]];then |
error 'Could not mount $(basename '${in}').' |
exit 1 |
fi |
# Create sparse image with a Single Partition UDIF |
info 'Creating sparse image...' |
hdiutil create -o '${TEMP_DIR}/osx' -size 7316m -type SPARSE -layout SPUD -fs HFS+J |
if [[ $?-ne 0 ]];then |
error 'Could not create sparse image.' |
exit 1 |
fi |
# Mount the sparse image |
info 'Mounting sparse image...' |
hdiutil attach '${SPARSE_IMAGE}' -noverify -nobrowse -mountpoint '${BUILD_MOUNT}' |
if [[ $?-ne 0 ]];then |
error 'Could not attach sparse image.' |
exit 1 |
fi |
# Restore the Base System into the sparse image |
info 'Restoring BaseSystem.dmg...' |
asr restore -source '${INPUT_MOUNT}/BaseSystem.dmg' -target '${BUILD_MOUNT}' -noprompt -noverify -erase |
if [[ $?-ne 0 ]];then |
error 'Could not mount BaseSystem.dmg.' |
exit 1 |
fi |
if [[ -d'/Volumes/OS X Base System' ]];then |
declare -r BASE_SYSTEM_PATH='/Volumes/OS X Base System' |
else |
# for Mac OS X Lion |
declare -r BASE_SYSTEM_PATH='/Volumes/Mac OS X Base System' |
fi |
declare -r PLIST='${BASE_SYSTEM_PATH}/System/Library/CoreServices/SystemVersion.plist' |
# Get installer OS product version |
local os_version |
os_version=$(/usr/libexec/PlistBuddy -c 'Print :ProductVersion''${PLIST}') |
if [[ $?-ne 0 ]];then |
error 'Could not get Product Version.' |
exit 1 |
fi |
# Get installer OS product build version |
local os_build |
os_build=$(/usr/libexec/PlistBuddy -c 'Print :ProductBuildVersion''${PLIST}') |
if [[ $?-ne 0 ]];then |
error 'Could not get Product Build Version.' |
exit 1 |
fi |
info 'Detected OS X version: ${os_version}, build ${os_build}' |
declare -r FILE_PATH='${out}/OS.X.${os_version}.${os_build}' |
# Remove Packages link and replace with actual files |
info 'Replacing Packages link with actual files...' |
rm '${BASE_SYSTEM_PATH}/System/Installation/Packages' |
if [[ $?-ne 0 ]];then |
error 'Could not remove Packages link.' |
exit 1 |
fi |
cp -rp '${INPUT_MOUNT}/Packages''${BASE_SYSTEM_PATH}/System/Installation/' |
if [[ $?-ne 0 ]];then |
error 'Could not replace Packages link with actual files.' |
exit 1 |
fi |
# Copy installer dependencies |
info 'Copying dependency files...' |
cp -rp '${INPUT_MOUNT}/BaseSystem.chunklist''${BASE_SYSTEM_PATH}/BaseSystem.chunklist' |
if [[ $?-ne 0 ]];then |
error 'Could not copy dependency files.' |
exit 1 |
fi |
cp -rp '${INPUT_MOUNT}/BaseSystem.dmg''${BASE_SYSTEM_PATH}/BaseSystem.dmg' |
if [[ $?-ne 0 ]];then |
error 'Could not copy dependency files.' |
exit 1 |
fi |
# Unmount the Base System image |
hdiutil detach '${BASE_SYSTEM_PATH}' |
# Unmount the installer image |
hdiutil detach '${INPUT_MOUNT}' |
# Resize sparse image |
#info 'Resizing sparse image...' |
#local size |
#size=$(hdiutil resize -limits '${SPARSE_IMAGE}' |
# | tail -n 1 |
# | awk '{ print $1 }') |
#echo 'Size= ${size}b' |
#hdiutil resize -size '${size}b' '${SPARSE_IMAGE}' |
#if [[ $? -ne 0 ]]; then |
# error 'Could not resize sparse iamge.' |
# exit 1 |
#fi |
# Convert sparse image to iso |
info 'Creating iso image...' |
hdiutil convert '${SPARSE_IMAGE}' -format UDTO -o '${FILE_PATH}' |
if [[ $?-ne 0 ]];then |
error 'Could not create iso image.' |
exit 1 |
fi |
# Rename the sparse image |
#info 'Renaming sparse image...' |
#mv '${SPARSE_IMAGE}' '${FILE_PATH}.dmg' |
#if [[ $? -ne 0 ]]; then |
# error 'Could not rename sparse image.' |
# exit 1 |
#fi |
# Rename the cdr image |
info 'Renaming cdr image...' |
mv '${FILE_PATH}.cdr''${FILE_PATH}.iso' |
if [[ $?-ne 0 ]];then |
error 'Could not rename cdr image.' |
exit 1 |
fi |
# Show completion message |
info 'Complete!!!' |
#info ' Path of dmg image: ${FILE_PATH}.dmg' |
info ' Path of iso image: ${FILE_PATH}.iso' |
} |
####################################### |
# Cleanup directories and files |
####################################### |
cleanup() { |
if [[ -d'${BUILD_MOUNT}' ]];then |
hdiutil detach '${BUILD_MOUNT}' |
fi |
if [[ -d'${OUTPUT_MOUNT}' ]];then |
hdiutil detach '${OUTPUT_MOUNT}' |
fi |
if [[ -d'${INPUT_MOUNT}' ]];then |
hdiutil detach '${INPUT_MOUNT}' |
fi |
if [[ -f'${SPARSE_IMAGE}' ]];then |
rm '${SPARSE_IMAGE}' |
fi |
rmdir '${TEMP_DIR}' |
shopt -u nocasematch |
} |
####################################### |
# main |
####################################### |
main() { |
echo -e '033[1;4mOS X Install ISO Creater033[0m' |
cat <<EOT |
Support OS X Version: 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 10.12 |
You need to download (Mac) OS X Installer from the Mac App Store and save it to the Application folder - its default location. |
Or, you can create iso from InstallESD.dmg you specified. |
EOT |
declare -a menu_items=('Mac OS X 10.7 (Lion)' |
'OS X 10.8 (Mountain Lion)' |
'OS X 10.9 (Mavericks)' |
'OS X 10.10 (Yosemite)' |
'OS X 10.11 (El Capitan)' |
'macOS 10.12 (Sierra)') |
declare -a osx_names=('Mac OS X Lion' |
'OS X Mountain Lion' |
'OS X Mavericks' |
'OS X Yosemite' |
'OS X El Capitan' |
'macOS Sierra') |
declare -r DMG_PATH_HEAD='/Applications/Install ' |
declare -r DMG_PATH_TAIL='.app/Contents/SharedSupport/InstallESD.dmg' |
local -i i=0 |
local dmg_path |
local output_dir |
# Check if installer exists |
fornamein'${osx_names[@]}';do |
dmg_path='${DMG_PATH_HEAD}${name}${DMG_PATH_TAIL}' |
if [[ !-f'${dmg_path}' ]];then |
unset menu_items[${i}] |
unset osx_names[${i}] |
fi |
let i++ |
done |
# Remove non-existent versions from array |
menu_items=('${menu_items[@]}') |
osx_names=('${osx_names[@]}') |
# Display menu items |
i=0 |
if [[ ${#menu_items[@]}-eq 0 ]];then |
echo -e 'No (Mac) OS X installer found.' |
echo -e 'Please Select:' |
else |
echo'Following ${#menu_items[@]} OS X installer(s) found.' |
echo -e 'Please Select:n' |
fornamein'${menu_items[@]}';do |
echo'$((i +1))) ${menu_items[${i}]}' |
let i++ |
done |
fi |
echo -e 'n0) Specifiy InstallESD.dmg path' |
echo -e 'nq) Quitn' |
# Read user selection |
while:;do |
read -rp $'e[1m''Enter a number or 'q': '$'e[0m' selection |
if [ '${selection}'-eq 0 ] 2> /dev/null;then |
read -ep $'e[1m''Enter the InstallESD.dmg path: '$'e[0m' dmg_path |
break |
elif [ '${selection}'-gt 0 ] 2> /dev/null && [ '${selection}'-le${i} ] 2> /dev/null;then |
dmg_path='${DMG_PATH_HEAD}${osx_names[$((selection - 1))]}${DMG_PATH_TAIL}' |
break |
elif [ '${selection}'='q' ];then |
exit |
break |
fi |
done |
# Read user output directory |
read -ep $'e[1m''Enter the output directory (default: ${DEFAULT_OUTPUT_DIR}): '$'e[0m' output_dir |
if [[ -z'${output_dir}' ]];then |
output_dir='${DEFAULT_OUTPUT_DIR}' |
fi |
create_image '${dmg_path}''${output_dir}' |
} |
main |
commented Dec 9, 2017 • edited
edited
Excellent work on this script @calvinbui |
commented Dec 15, 2017
Hi, |
Macos Mojave 10.14 Iso
commented Jul 9, 2018
Linux Iso Download
Hello, Is there any way that you can update the support for MAC OS High Sierra, And Mojave??? @calvinbui |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Download Macos Mojave To Usb
macOS_Mojave_touristd.mobileconfig
<?xml version='1.0' encoding='UTF-8'?> |
<!DOCTYPEplist PUBLIC '-//Apple//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'> |
<plistversion='1.0'> |
<dict> |
<key>PayloadContent</key> |
<array> |
<dict> |
<key>PayloadContent</key> |
<dict> |
<key>com.apple.touristd</key> |
<dict> |
<key>Forced</key> |
<array> |
<dict> |
<key>mcx_preference_settings</key> |
<dict> |
<key>firstOSLogin</key> |
<date>2018-10-04T04:30:47Z</date> |
<key>seed-notificationDueDate-lQlm1yrMS0GPVyAL44id+A</key> |
<date>2018-10-04T08:30:47Z</date> |
<key>seed-numNotifications-+trJt2VsTvK1yfPGwOySDw</key> |
<string>0</string> |
<key>seed-numNotifications-/+vP78HsSh+Yeb4xJnUT9A</key> |
<string>0</string> |
<key>seed-numNotifications-2+LvxAVyT6qnV1sDMZT0NA</key> |
<string>0</string> |
<key>seed-numNotifications-40reAuuYTHOsx4oGcx4qrA</key> |
<string>0</string> |
<key>seed-numNotifications-APhNaYV1RxSS41lC7ZJJ9Q</key> |
<string>0</string> |
<key>seed-numNotifications-B70mVuHeT0WUgKh/VdUuZQ</key> |
<string>0</string> |
<key>seed-numNotifications-ETJeJ9/1QmmWUde7uK8fDg</key> |
<string>0</string> |
<key>seed-numNotifications-EWfaSdJwR/6f1BYGiyLpcQ</key> |
<string>0</string> |
<key>seed-numNotifications-EeEFv8cyS0CVe3ia2UEehA</key> |
<string>0</string> |
<key>seed-numNotifications-FQrkbNP9ThKQQtpqx2saFg</key> |
<string>0</string> |
<key>seed-numNotifications-GZAJdmpdSqmfH2PkCr8ebw</key> |
<string>0</string> |
<key>seed-numNotifications-JTecrrXDSVut2tSfltty9Q</key> |
<string>0</string> |
<key>seed-numNotifications-KwUoo0fRRM2VPmIm0V67xg</key> |
<string>0</string> |
<key>seed-numNotifications-LR2P9+rnQ2q9xSUy1ZgWOw</key> |
<string>0</string> |
<key>seed-numNotifications-MM3ne3nTR9eXFyVwZ5gN7Q</key> |
<string>0</string> |
<key>seed-numNotifications-Pa88nesPSO6POlutVN4/Sg</key> |
<string>0</string> |
<key>seed-numNotifications-SdV08ZZQRxOCWq6JBEXmfg</key> |
<string>0</string> |
<key>seed-numNotifications-UhiR1M79RWmXLIQr4M0AWw</key> |
<string>0</string> |
<key>seed-numNotifications-WEyaCPMVRB6HbnmRq9EnNQ</key> |
<string>0</string> |
<key>seed-numNotifications-We59wh+OTa6c1yas/yppwg</key> |
<string>0</string> |
<key>seed-numNotifications-b/dLke8ZTQaN9KKrxfwDQw</key> |
<string>0</string> |
<key>seed-numNotifications-bydF6fX5Sp6aBYdEXD0VwQ</key> |
<string>0</string> |
<key>seed-numNotifications-d+gfl8CNTNeauANKjf9WqA</key> |
<string>0</string> |
<key>seed-numNotifications-f/Pn3F4RScOh+GUBKO9sRA</key> |
<string>0</string> |
<key>seed-numNotifications-fWRpNw7IR3S3qxX63nmvMw</key> |
<string>0</string> |
<key>seed-numNotifications-krdWS8DSQIqJSqQFXW1/pw</key> |
<string>0</string> |
<key>seed-numNotifications-kti4ZkMKQFyCL2kbgCY23A</key> |
<string>0</string> |
<key>seed-numNotifications-lEDfW5O+SZe8KTQ93HGOPA</key> |
<string>0</string> |
<key>seed-numNotifications-lQlm1yrMS0GPVyAL44id+A</key> |
<string>1</string> |
<key>seed-numNotifications-n87FVu1TSwGzble8vqBvsg</key> |
<string>0</string> |
<key>seed-numNotifications-pDWyREoARJm5V1mJYr9GKg</key> |
<string>0</string> |
<key>seed-numNotifications-srluh6uOQiuWCzxguqhDNw</key> |
<string>0</string> |
<key>seed-viewed-lQlm1yrMS0GPVyAL44id+A</key> |
<date>2018-10-04T04:31:34Z</date> |
</dict> |
</dict> |
</array> |
</dict> |
</dict> |
<key>PayloadEnabled</key> |
<true/> |
<key>PayloadIdentifier</key> |
<string>MCXToProfile.c9db05a8-1cb7-4e5c-b732-7859d9931d64.alacarte.customsettings.bc1bba29-efd7-4cc8-9a10-36e550c22c4b</string> |
<key>PayloadType</key> |
<string>com.apple.ManagedClient.preferences</string> |
<key>PayloadUUID</key> |
<string>bc1bba29-efd7-4cc8-9a10-36e550c22c4b</string> |
<key>PayloadVersion</key> |
<integer>1</integer> |
</dict> |
</array> |
<key>PayloadDescription</key> |
<string>Included custom settings: |
com.apple.touristd |
Git revision: a0e04c60fc</string> |
<key>PayloadDisplayName</key> |
<string>MCXToProfile: com.apple.touristd</string> |
<key>PayloadIdentifier</key> |
<string>macOS_Mojave_TouristD</string> |
<key>PayloadOrganization</key> |
<string></string> |
<key>PayloadRemovalDisallowed</key> |
<true/> |
<key>PayloadScope</key> |
<string>System</string> |
<key>PayloadType</key> |
<string>Configuration</string> |
<key>PayloadUUID</key> |
<string>c9db05a8-1cb7-4e5c-b732-7859d9931d64</string> |
<key>PayloadVersion</key> |
<integer>1</integer> |
</dict> |
</plist> |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment