How to Install Google Chrome from the command line

Solution 1:

I found this after mucking around with the page source:

https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg

Solution 2:

I have used a script like this to copy applications from disk images:

temp=$TMPDIR$(uuidgen)
mkdir -p $temp/mount
curl https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg > $temp/1.dmg
yes | hdiutil attach -noverify -nobrowse -mountpoint $temp/mount $temp/1.dmg
cp -r $temp/mount/*.app /Applications
hdiutil detach $temp/mount
rm -r $temp
  • Without -mountpoint the dmg is mounted to a directory like /Volume/Google\ Chrome/.
  • -nobrowse doesn't show the volume in Finder.
  • If the dmg has a license agreement, yes | skips it.
  • cp preserves extended attributes (which includes resource forks) and ACLs by default. As far as I know, ditto is no longer needed for copying application bundles.

Or using brew-cask:

brew install brew-cask
brew cask install google-chrome

brew-cask installs applications to /opt/homebrew-cask/Caskroom/ and creates aliases to ~/Applications/ by default.

Solution 3:

brew cask install google-chrome also works if you have homebrew.

(It basically does the same thing as your final solution)

edit: homebrew has a new syntax for casks:

brew install --cask google-chrome