Skip to main content
Solved

Google Chrome script for installing either Intel or M1 (Apple Silicon) no packaging needed.


Forum|alt.badge.img+7

I have created a script to check for Architecture and snag the correct installer for Chrome. This is currently working, hope this helps others.

There is a similar Topic here: https://community.jamf.com/t5/jamf-pro/install-latest-version-of-google-chrome-without-re-packaging/m-p/156742/page/2

Wanted to start a new one with the focus on Intel and M1

Thanks to @cbrewer for the solution I did not need to choose between and intel and an M1 installer, I also Changed the .dmg to a .pkg with the extra bit of agreeing to the license etc, with the appended URL.

 

#!/bin/zsh # Changed the installer from .dmg to .pkg and took out the bit for choosing an architecture. # make temp folder for downloads mkdir "/tmp/googlechrome" # change working directory cd "/tmp/googlechrome" # Download Google Chrome curl -L -o "/tmp/googlechrome/googlechrome.pkg" "https://dl.google.com/chrome/mac/stable/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/googlechrome.pkg" # Install Google Chrome sudo /usr/sbin/installer -pkg googlechrome.pkg -target / #Tidy Up sudo rm -rf "/tmp/googlechrome" #Bless Google Chrome app xattr -rc "/Applications/Google Chrome.app"

 

In case anyone has found an installer that has separate Installers for Intel Vs. ARM You could use this as a template in the download section:

 

# Download Correct installer based on Architecture arch_name="$(uname -m)" if [ "${arch_name}" = "x86_64" ]; then curl -L -o "<path to temp directory>/<Package Name>" "URL to Intel Package" elif [ "${arch_name}" = "arm64"] then curl -L -o "<path to temp directory>/<Package Name>" "URL to ARM Package" fi

 

 

Best answer by cbrewer

Any reason you're not just using the universal copy for all Macs?

Also, Google offers a package installer which might be preferred depending on what you're trying to accomplish. I believe the package installer will install the Google Keystone updater for you, but maybe you're trying to avoid that.

 

https://support.google.com/chrome/a/answer/9915669?hl=en

 

View original
Did this topic help you find an answer to your question?

35 replies

Forum|alt.badge.img+15
  • Esteemed Contributor
  • 719 replies
  • October 29, 2021

Why not just put the Universal copy on all of your Macs? Chrome offers a universal pkg installer.

 

You can also automatically accept the terms and conditions by placing the following between your download path and the package name:

accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms

 

The full URL would look like:

https://dl.google.com/chrome/mac/stable/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/GoogleChrome.pkg

 

https://support.google.com/chrome/a/answer/9915669?hl=en


Forum|alt.badge.img+15
  • Esteemed Contributor
  • 719 replies
  • October 30, 2021

Any reason you're not just using the universal copy for all Macs?

Also, Google offers a package installer which might be preferred depending on what you're trying to accomplish. I believe the package installer will install the Google Keystone updater for you, but maybe you're trying to avoid that.

https://support.google.com/chrome/a/answer/9915669?hl=en

 

https://dl.google.com/chrome/mac/stable/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/GoogleChrome.pkg


Forum|alt.badge.img+15
  • Esteemed Contributor
  • 719 replies
  • Answer
  • October 30, 2021

Any reason you're not just using the universal copy for all Macs?

Also, Google offers a package installer which might be preferred depending on what you're trying to accomplish. I believe the package installer will install the Google Keystone updater for you, but maybe you're trying to avoid that.

 

https://support.google.com/chrome/a/answer/9915669?hl=en

 


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 1, 2021
cbrewer wrote:

Any reason you're not just using the universal copy for all Macs?

Also, Google offers a package installer which might be preferred depending on what you're trying to accomplish. I believe the package installer will install the Google Keystone updater for you, but maybe you're trying to avoid that.

 

https://support.google.com/chrome/a/answer/9915669?hl=en

 


Good to know, I mean it makes sense that the Universal version is, well Universal! I think I was confused as when you go and manually download they make a really big deal about choosing an Intel Installer vs the arm64 (M1 installer).

Wondering why they would make you choose if there was not difference. Why wouldn't google just have everyone download the Universal version? Maybe google got lazy on this one, like at one time there were 2 diff packages.

 

To be fair this does what I set out to do, maybe the architecture lookup can help someone who finds an app where they actually are separate. I already have one in my env. We also have Google Chrome Manager in place so that takes care of all of the settings we need.


Forum|alt.badge.img+2
  • New Contributor
  • 12 replies
  • November 1, 2021
cbrewer wrote:

Any reason you're not just using the universal copy for all Macs?

Also, Google offers a package installer which might be preferred depending on what you're trying to accomplish. I believe the package installer will install the Google Keystone updater for you, but maybe you're trying to avoid that.

 

https://support.google.com/chrome/a/answer/9915669?hl=en

 


Hello, with the package deployed I am constantly getting the error 11 when going to "About Google Chrome".

Update failed (error: 11)

Error details:
Updates are disabled.
Version 95.0.4638.69 (Official Build) (x86_64)
 
I tried removing ~/Library/Google/GoogleSoftwareUpdate and /Library/Google/GoogleSoftwareUpdate folders and then reinstalled Google Software Update and reinstalled Chrome using the package but for some reason I always wend up with that error. 

Any ideas what might be causing this? Could you expand on what you said about "the package installer will install the Google Keystone updater for you.."? Thank you

Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 1, 2021
beareye321 wrote:

Hello, with the package deployed I am constantly getting the error 11 when going to "About Google Chrome".

Update failed (error: 11)

Error details:
Updates are disabled.
Version 95.0.4638.69 (Official Build) (x86_64)
 
I tried removing ~/Library/Google/GoogleSoftwareUpdate and /Library/Google/GoogleSoftwareUpdate folders and then reinstalled Google Software Update and reinstalled Chrome using the package but for some reason I always wend up with that error. 

Any ideas what might be causing this? Could you expand on what you said about "the package installer will install the Google Keystone updater for you.."? Thank you

I believe he is saying in the script if you replace all of the .dmg with .pkg the installer will come down as a .pkg instead. And change the install part from Copy the contents to run the installer. I can see if I can work on that bit.

 

 

 


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 1, 2021
beareye321 wrote:

Hello, with the package deployed I am constantly getting the error 11 when going to "About Google Chrome".

Update failed (error: 11)

Error details:
Updates are disabled.
Version 95.0.4638.69 (Official Build) (x86_64)
 
I tried removing ~/Library/Google/GoogleSoftwareUpdate and /Library/Google/GoogleSoftwareUpdate folders and then reinstalled Google Software Update and reinstalled Chrome using the package but for some reason I always wend up with that error. 

Any ideas what might be causing this? Could you expand on what you said about "the package installer will install the Google Keystone updater for you.."? Thank you

Something like this:

 

 

#!/bin/zsh # make temp folder for downloads mkdir "/tmp/googlechrome" # change working directory cd "/tmp/googlechrome" # Download Google Chrome curl -L -o "/tmp/googlechrome/googlechrome.pkg" "https://dl.google.com/chrome/mac/stable/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/googlechrome.pkg" # Install Google Chrome sudo /usr/sbin/installer -pkg googlechrome.pkg -target / #Tidy Up sudo rm -rf "/tmp/googlechrome" #Bless Google Chrome app xattr -rc "/Applications/Google Chrome.app"

 

 

 


Forum|alt.badge.img+4
  • Contributor
  • 10 replies
  • November 15, 2021

I tried using the Universal link but it wont install on M1. Installer just spins. Does anyone have the direct link to the ARM installer?


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 15, 2021
NRutkowski wrote:

I tried using the Universal link but it wont install on M1. Installer just spins. Does anyone have the direct link to the ARM installer?


The link is in the script above, that is a universal installer which I currently have working for both intel and M1, I just tried this script before responding to make sure. As long as you run as root locally you should be all set.

 

sudo sh /path/to/script

 

or if you paste this into the scripts in Jamf and use that script in a policy.


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 15, 2021
NRutkowski wrote:

I tried using the Universal link but it wont install on M1. Installer just spins. Does anyone have the direct link to the ARM installer?


They make an Intel Only version, and the Universal version which works on Both ARM (M1) and intel. They do not make one specifically for just ARM unless I am sorely mistaken.


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 15, 2021
Geissbuhler wrote:

They make an Intel Only version, and the Universal version which works on Both ARM (M1) and intel. They do not make one specifically for just ARM unless I am sorely mistaken.


If you are looking for the link without the agree to it should be:

https://dl.google.com/chrome/mac/stable/googlechrome.pkg

 


Forum|alt.badge.img+4
  • Contributor
  • 10 replies
  • November 15, 2021
Geissbuhler wrote:

The link is in the script above, that is a universal installer which I currently have working for both intel and M1, I just tried this script before responding to make sure. As long as you run as root locally you should be all set.

 

sudo sh /path/to/script

 

or if you paste this into the scripts in Jamf and use that script in a policy.


I'm using jamf to deploy via script you posted. The self service downloads the file but spins when installing. Never completes, doesn't error. 


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 15, 2021
NRutkowski wrote:

I'm using jamf to deploy via script you posted. The self service downloads the file but spins when installing. Never completes, doesn't error. 


Can you post your logs from the policy?


Forum|alt.badge.img+4
  • Contributor
  • 10 replies
  • November 17, 2021
Geissbuhler wrote:

Can you post your logs from the policy?


There are none. It says pending. I let it run for a while and its still processing. The script successfully ran on an intel iMac. 


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 17, 2021
NRutkowski wrote:

There are none. It says pending. I let it run for a while and its still processing. The script successfully ran on an intel iMac. 


I have changed this script a few times, can you please copy and paste the exact script you are using back here please 🙂


Forum|alt.badge.img+4
  • Contributor
  • 10 replies
  • November 17, 2021
Geissbuhler wrote:

I have changed this script a few times, can you please copy and paste the exact script you are using back here please 🙂


#!/bin/zsh
# Changed the installer from .dmg to .pkg and took out the bit for choosing an architecture.

# make temp folder for downloads

mkdir "/tmp/googlechrome"

# change working directory

cd "/tmp/googlechrome"

# Download Google Chrome

curl -L -o "/tmp/googlechrome/googlechrome.pkg" "https://dl.google.com/chrome/mac/stable/googlechrome.pkg"

# Install Google Chrome

sudo /usr/sbin/installer -pkg googlechrome.pkg -target /

#Tidy Up

sudo rm -rf "/tmp/googlechrome"

#Bless Google Chrome app

xattr -rc "/Applications/Google Chrome.app"


Forum|alt.badge.img+4
  • Contributor
  • 10 replies
  • November 17, 2021
NRutkowski wrote:

#!/bin/zsh
# Changed the installer from .dmg to .pkg and took out the bit for choosing an architecture.

# make temp folder for downloads

mkdir "/tmp/googlechrome"

# change working directory

cd "/tmp/googlechrome"

# Download Google Chrome

curl -L -o "/tmp/googlechrome/googlechrome.pkg" "https://dl.google.com/chrome/mac/stable/googlechrome.pkg"

# Install Google Chrome

sudo /usr/sbin/installer -pkg googlechrome.pkg -target /

#Tidy Up

sudo rm -rf "/tmp/googlechrome"

#Bless Google Chrome app

xattr -rc "/Applications/Google Chrome.app"


I should also add that i've tried it with both the short direct link and the longer agreement link. 


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 17, 2021
NRutkowski wrote:

I should also add that i've tried it with both the short direct link and the longer agreement link. 


This is my current Policy for self Service:

Contents of Scripts

Chrome - Pregame Self Service:

 

#!/bin/bash killall "Google Chrome" rm -rf /Applications/Google\\ Chrome.app exit 0

 

z - Open Google Chrome:

 

#!/bin/zsh open /Applications/Google\\ Chrome.app

 

I am still using the redundant script that chooses architecture:

Download and install Google Chrome:

 

#!/bin/zsh # make temp folder for downloads mkdir "/tmp/googlechrome" # change working directory cd "/tmp/googlechrome" # Download Correct Google Chrome based on Architecture arch_name="$(uname -m)" if [ "${arch_name}" = "x86_64" ]; then curl -L -o "/tmp/googlechrome/Googlechrome.dmg" "https://dl.google.com/chrome/mac/stable/GGRO/Googlechrome.dmg" elif [ "${arch_name}" = "arm64" ]; then curl -L -o "/tmp/googlechrome/Googlechrome.dmg" "https://dl.google.com/chrome/mac/universal/stable/GGRO/Googlechrome.dmg" fi # Mount the DMG hdiutil attach Googlechrome.dmg -nobrowse # Install Google Chrome cp -r /Volumes/Google\\ Chrome/*app /Applications #Tidy Up hdiutil unmount "/Volumes/Google Chrome" sleep 5 sudo rm -rf "/tmp/googlechrome" sleep 5 #Bless Google Chrome app xattr -rc "/Applications/Google Chrome.app"

 

Let me know if this works for you.


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 17, 2021
NRutkowski wrote:

I should also add that i've tried it with both the short direct link and the longer agreement link. 


I have these in place as best practices for my Org is to have the Self Service Policy do the following:

1. Stop the running process of the app.
2. Remove the current installed version.
3. Install current version
4. Launch the app.

All of these are named in specific alphabetical order so they launch in appropriate sequence.


Forum|alt.badge.img+4
  • Contributor
  • 10 replies
  • November 17, 2021
Geissbuhler wrote:

This is my current Policy for self Service:

Contents of Scripts

Chrome - Pregame Self Service:

 

#!/bin/bash killall "Google Chrome" rm -rf /Applications/Google\\ Chrome.app exit 0

 

z - Open Google Chrome:

 

#!/bin/zsh open /Applications/Google\\ Chrome.app

 

I am still using the redundant script that chooses architecture:

Download and install Google Chrome:

 

#!/bin/zsh # make temp folder for downloads mkdir "/tmp/googlechrome" # change working directory cd "/tmp/googlechrome" # Download Correct Google Chrome based on Architecture arch_name="$(uname -m)" if [ "${arch_name}" = "x86_64" ]; then curl -L -o "/tmp/googlechrome/Googlechrome.dmg" "https://dl.google.com/chrome/mac/stable/GGRO/Googlechrome.dmg" elif [ "${arch_name}" = "arm64" ]; then curl -L -o "/tmp/googlechrome/Googlechrome.dmg" "https://dl.google.com/chrome/mac/universal/stable/GGRO/Googlechrome.dmg" fi # Mount the DMG hdiutil attach Googlechrome.dmg -nobrowse # Install Google Chrome cp -r /Volumes/Google\\ Chrome/*app /Applications #Tidy Up hdiutil unmount "/Volumes/Google Chrome" sleep 5 sudo rm -rf "/tmp/googlechrome" sleep 5 #Bless Google Chrome app xattr -rc "/Applications/Google Chrome.app"

 

Let me know if this works for you.


I see that it downloaded the file and mounted the DMG. but again same. it fails to process the installer. I am starting to think that something else may be an issue. I installed rosetta earlier, as it was required by another app.


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 17, 2021
NRutkowski wrote:

I should also add that i've tried it with both the short direct link and the longer agreement link. 


Just to make sure, I have also had the script that only calls the universal installer working on M1 as well, just ran it. (Used the exact set of scripts as above, only swapping the Download and Install Google Chrome Script")

 

 

Contents of script
Download and Install Google Chrome Universal installer only:

 

 

#!/bin/zsh # Changed the installer from .dmg to .pkg and took out the bit for choosing an architecture. # make temp folder for downloads mkdir "/tmp/googlechrome" # change working directory cd "/tmp/googlechrome" # Download Google Chrome curl -L -o "/tmp/googlechrome/googlechrome.pkg" "https://dl.google.com/chrome/mac/stable/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/googlechrome.pkg" # Install Google Chrome sudo /usr/sbin/installer -pkg googlechrome.pkg -target / # Tidy Up sudo rm -rf "/tmp/googlechrome" # Bless Google Chrome app xattr -rc "/Applications/Google Chrome.app"

 

 




Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 17, 2021
NRutkowski wrote:

I see that it downloaded the file and mounted the DMG. but again same. it fails to process the installer. I am starting to think that something else may be an issue. I installed rosetta earlier, as it was required by another app.


In that case I would love to see if you could try this on a fresh machine or that same machine wiped. I have had the luck of testing Monterey for a bit now, that "erase all contents and settings" is a major help, I basically get the machine from wiped to all set up in ~ 10 min now.

I have tested this policy on both Monterey and Big sur this AM just to be sure there was nothing OS wise causing this as well.

Feel free to reach out if you need anything 🙂


Forum|alt.badge.img+4
  • Contributor
  • 10 replies
  • November 17, 2021
Geissbuhler wrote:

Just to make sure, I have also had the script that only calls the universal installer working on M1 as well, just ran it. (Used the exact set of scripts as above, only swapping the Download and Install Google Chrome Script")

 

 

Contents of script
Download and Install Google Chrome Universal installer only:

 

 

#!/bin/zsh # Changed the installer from .dmg to .pkg and took out the bit for choosing an architecture. # make temp folder for downloads mkdir "/tmp/googlechrome" # change working directory cd "/tmp/googlechrome" # Download Google Chrome curl -L -o "/tmp/googlechrome/googlechrome.pkg" "https://dl.google.com/chrome/mac/stable/accept_tos%3Dhttps%253A%252F%252Fwww.google.com%252Fintl%252Fen_ph%252Fchrome%252Fterms%252F%26_and_accept_tos%3Dhttps%253A%252F%252Fpolicies.google.com%252Fterms/googlechrome.pkg" # Install Google Chrome sudo /usr/sbin/installer -pkg googlechrome.pkg -target / # Tidy Up sudo rm -rf "/tmp/googlechrome" # Bless Google Chrome app xattr -rc "/Applications/Google Chrome.app"

 

 




After a wipe and reinstall.  It still doesn't run but I got an error. 

[STEP 1 of 6]
Executing Policy Install Latest Google Chrome V4
[STEP 2 of 6]
Running script Google install Script 1...
Script exit code: 0
Script result: No matching processes were found
[STEP 3 of 6]
Running script Google install Script 2...
Script exit code: 1
Script result: The file /Applications/Google Chrome.app does not exist.
Error running script: return code was 1.
[STEP 4 of 6]
Running script Google install Script 3...
Script exit code: 0
Script result: % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 10 201M 10 21.1M 0 0 22.2M 0 0:00:09 --:--:-- 0:00:09 22.1M 46 201M 46 93.8M 0 0 47.1M 0 0:00:04 0:00:01 0:00:03 47.1M 69 201M 69 140M 0 0 47.6M 0 0:00:04 0:00:02 0:00:02 47.6M 94 201M 94 189M 0 0 47.8M 0 0:00:04 0:00:03 0:00:01 47.8M 100 201M 100 201M 0 0 48.9M 0 0:00:04 0:00:04 --:--:-- 48.9M installer: Package name is Google Chrome installer: Installing at base path / installer: The install was successful.
[STEP 5 of 6]
[STEP 6 of 6]

Forum|alt.badge.img+4
  • Contributor
  • 10 replies
  • November 17, 2021
NRutkowski wrote:

After a wipe and reinstall.  It still doesn't run but I got an error. 

[STEP 1 of 6]
Executing Policy Install Latest Google Chrome V4
[STEP 2 of 6]
Running script Google install Script 1...
Script exit code: 0
Script result: No matching processes were found
[STEP 3 of 6]
Running script Google install Script 2...
Script exit code: 1
Script result: The file /Applications/Google Chrome.app does not exist.
Error running script: return code was 1.
[STEP 4 of 6]
Running script Google install Script 3...
Script exit code: 0
Script result: % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 10 201M 10 21.1M 0 0 22.2M 0 0:00:09 --:--:-- 0:00:09 22.1M 46 201M 46 93.8M 0 0 47.1M 0 0:00:04 0:00:01 0:00:03 47.1M 69 201M 69 140M 0 0 47.6M 0 0:00:04 0:00:02 0:00:02 47.6M 94 201M 94 189M 0 0 47.8M 0 0:00:04 0:00:03 0:00:01 47.8M 100 201M 100 201M 0 0 48.9M 0 0:00:04 0:00:04 --:--:-- 48.9M installer: Package name is Google Chrome installer: Installing at base path / installer: The install was successful.
[STEP 5 of 6]
[STEP 6 of 6]

I think I see where it errored. In the 2nd script. It failed to launch an app that doesn't exist. I did check the app installed. Thank you for your help.


Forum|alt.badge.img+7
  • Author
  • Contributor
  • 71 replies
  • November 17, 2021
NRutkowski wrote:

I think I see where it errored. In the 2nd script. It failed to launch an app that doesn't exist. I did check the app installed. Thank you for your help.


Looks like they are running out of order, likely due to naming of the scripts or not having before/after set properly like in my screenshots.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings