How to Install Google Chrome from the command line

I'd like to do something similar to:

wget 

except download the OS X version (from ? URL) and install it from the command line. The corresponding instructions for installing Google Chrome on Ubuntu can be found here. I've searched high and low and Google does not seem to make the link available anywhere.

I'm trying to write a script to automate installation of my standard applications for OS X. I use a set of scripts like this already to set up my Ubuntu box. Specifically, I can't seem to find the URL for the Google Chrome OS X 64 bit direct download.


Edit, final solution:

wget
open ~/Downloads/googlechrome.dmg
sudo cp -r /Volumes/Google\ Chrome/Google\ Chrome.app /Applications/

7 Answers

I found this after mucking around with the page source:

1

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

temp=$TMPDIR$(uuidgen)
mkdir -p $temp/mount
curl > $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.

1

edit 2022: brew install can now do casks by default

brew install google-chrome

(Thanks to wisbucky for bringing it up in a comment below)

edit 2019: homebrew has a new syntax for casks:

brew install --cask google-chrome

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

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

5

I was interested in being able to download any of their branches. If you look at the file, you'll see the links you need. Here is an excerpt.

Pn(a,"win64")?"/update2/installers/ChromeStandaloneSetup64.exe":"/update2/installers/ChromeStandaloneSetup.exe":"/update2/installers/ChromeSetup.exe";else if(Wn(a))if(a.sb)a="/chrome/mac/beta/GoogleChrome.dmg";else if(a.ta)a="/release2/q/canary/googlechrome.dmg";else if(a.Sa)a="/chrome/mac/dev/GoogleChrome.dmg";else{a="GGRO";var b=new Y(location.href),b=qk(b,"brand");if(b=b.length&&b[0])for(var c=0,d=Gn.length;c<d;c++){var f=Gn[c],h=f.ki;if(f.Vj.test(b)){a=h;break}}a=pa("/chrome/mac/stable/%s/googlechrome.dmg",a)}else a=Xn(a)?An[a.Bj+(a.sb?"-b":a.Sa?"-d":"")]:"/update2/installers/ChromeSetup.exe";return a}e.Rr=function(a){this.sm=a};

As you can see from doing a simple search on the minified code above, you'll find the last half of the links that should be concatenated with

The way to install Google Chrome will be to download & install it manually through click and install. Download appropriate Google Chrome Deb package. Then sudo dpkg -i . ... Add the key. Set Repository. Update package. Install chrome.

Because at the first install you don't have wget or brew, you can use curl, this works for me:

curl --output googlechrome.dmg

Here is a way to download it for Macs using Intel or Apple Chips.

 if [[ `arch` == arm64 ]]; then echo "Architecture is Apple ARM" curl --output googlechrome.dmg else echo "Architecture is Intel X86" curl --output googlechrome.dmg fi

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like