Skip to content

Instantly share code, notes, and snippets.

@LewisLebentz
Created March 8, 2017 21:32
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LewisLebentz/980acccde324da79c6cfd24472c3ee4d to your computer and use it in GitHub Desktop.
Save LewisLebentz/980acccde324da79c6cfd24472c3ee4d to your computer and use it in GitHub Desktop.
Downloads the latest Google Chrome DMG file and installs it on a Mac
#!/bin/sh
dmgfile="googlechrome.dmg"
volname="Google Chrome"
logfile="/Library/Logs/GoogleChromeInstallScript.log"
url='https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg'
/bin/echo "--" >> ${logfile}
/bin/echo "`date`: Downloading latest version." >> ${logfile}
/usr/bin/curl -s -o /tmp/${dmgfile} ${url}
/bin/echo "`date`: Mounting installer disk image." >> ${logfile}
/usr/bin/hdiutil attach /tmp/${dmgfile} -nobrowse -quiet
/bin/echo "`date`: Installing..." >> ${logfile}
ditto -rsrc "/Volumes/${volname}/Google Chrome.app" "/Applications/Google Chrome.app"
/bin/sleep 10
/bin/echo "`date`: Unmounting installer disk image." >> ${logfile}
/usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep "${volname}" | awk '{print $1}') -quiet
/bin/sleep 10
/bin/echo "`date`: Deleting disk image." >> ${logfile}
/bin/rm /tmp/"${dmgfile}"
exit 0
@Maymorning2
Copy link

trying to install

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