#!/bin/sh # MakeYosemite.sh # # # Created by Johnykutty on 12/24/14. # red_color='\033[1;31m' green_color='\033[0;32m' endColor='\033[0m' # No Color diskutil list echo "Enter name of the disc you want to make bootable (choose from above): " read usb_flash_drive if disk_info=$(diskutil list $usb_flash_drive) ; then echo "${green_color}Disk exists${endColor}" else echo "${red_color}$disk_info ${endColor}" exit fi #Make sure user allows to erase the contents echo "Do you want to erase all contents of $usb_flash_drive ? ${green_color}Y${endColor}/${red_color}N${endColor}" read -p "" RESP YES="y" if echo $RESP | grep -i "^${YES}$" > /dev/null ; then echo "${green_color}Erasing $usb_flash_drive .... " else echo "${red_color}Exiting...${endColor}" exit fi echo "${green_color}Erasing $usb_flash_drive .... " disk_name='Install_OS_X_Yosemite' diskutil eraseDisk JHFS+ $disk_name $usb_flash_drive echo "Enter full path to OS X Yosemite installer : ${end_color}" read -r installer_path if result=$(sudo "$installer_path"/Contents/Resources/createinstallmedia --volume /Volumes/$disk_name --applicationpath "$installer_path" --nointeraction) ; then echo "${green_color}Completed process use $disk_name to install OS X Yosemite and have fun :) ${endColor}" else echo "${red_color}Failed to create installer $result ${endColor}" fi