10-29-2021 07:36 AM - edited 11-01-2021 10:37 AM
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/...
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
Solved! Go to Solution.
Posted on 10-30-2021 12:08 PM
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
11-01-2021 09:53 AM - edited 11-01-2021 09:57 AM
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"
Posted on 10-29-2021 11:50 AM
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:
Posted on 10-30-2021 12:07 PM
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
Posted on 10-30-2021 12:08 PM
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
Posted on 11-01-2021 07:19 AM
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.
Posted on 11-01-2021 08:10 AM
Hello, with the package deployed I am constantly getting the error 11 when going to "About Google Chrome".
Updates are disabled.
Posted on 11-01-2021 09:19 AM
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.
11-01-2021 09:53 AM - edited 11-01-2021 09:57 AM
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"
Posted on 11-15-2021 03:26 PM
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?
Posted on 11-15-2021 03:42 PM
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.
Posted on 11-15-2021 03:56 PM
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.
Posted on 11-15-2021 03:59 PM
Can you post your logs from the policy?
Posted on 11-17-2021 08:05 AM
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.
Posted on 11-17-2021 08:11 AM
I have changed this script a few times, can you please copy and paste the exact script you are using back here please 🙂
Posted on 11-17-2021 08:13 AM
#!/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"
Posted on 11-17-2021 08:14 AM
I should also add that i've tried it with both the short direct link and the longer agreement link.
11-17-2021 08:27 AM - edited 11-17-2021 08:30 AM
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.
11-17-2021 08:53 AM - edited 11-17-2021 08:54 AM
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.
Posted on 11-17-2021 09:05 AM
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 🙂
11-17-2021 08:41 AM - edited 11-17-2021 08:58 AM
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.
11-17-2021 08:54 AM - edited 11-17-2021 08:59 AM
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"
Posted on 11-17-2021 10:41 AM
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] |
Posted on 11-17-2021 10:43 AM
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.
Posted on 11-17-2021 10:47 AM
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.
Posted on 11-17-2021 10:49 AM
We want the launch one to run last, that's why I put a "z -" in the title.
Posted on 11-15-2021 03:49 PM
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.
11-15-2021 03:53 PM - edited 11-15-2021 03:55 PM
If you are looking for the link without the agree to it should be:
https://dl.google.com/chrome/mac/stable/googlechrome.pkg
Posted on 11-19-2021 11:21 AM
I'm looking to run this script and it runs fine in terminal, but does not run when deployed via Self Service. Chrome isn't our primary browser, so it's only available there and will be left up to the user to update. No part of the script, from beginning to end runs properly. It's like self service isn't even trying to run it. Any ideas on where this could be hanging up? It has been copied and pasted directly from the latest script above.
Posted on 11-19-2021 01:51 PM
I've had this happen before, what happens when you delete the policy and try again?
Posted on 11-19-2021 01:56 PM
Also screenshots of the elements of the policy may help us as well if after recreation it is still not working 🙂
Posted on 11-22-2021 08:42 AM
I ended up with the same result. Just a failure notification from Self Service and seemingly no activity takes place. I'm watching /tmp for the googlechrome folder to appear as my point of reference for if the script is even trying to run. I've also looked for logs, but luck there either.
Posted on 12-02-2021 09:49 AM
Very Strange, have you tried choosing a trigger (I know it's not needed with Self Service) or recreating it from scratch, I have had multiple policies fail on me (no indication of running) and had to recreate them for some reason, or is there anything that might prevent this from running on the machine, like another policy?
Posted on 12-13-2021 07:09 AM
I finally broke down and hit up Jamf support. Looks like something just happened to be broken on the couple machines that I was testing on, regarding the device certificate for Jamf. I renewed it through terminal and archived the old one. That seemed to do the trick. It was weird because all of the other functions of Jamf were working through self service. App installation, etc. and the device was sending inventory and check-ins to our Jamf Pro server, but JUST scripts were broken. We're good now and the script works perfectly as written, so thank you for sharing it!
Posted on 12-13-2021 11:15 AM
You are very welcome, glad you eventually got it up and running! 🙂
05-11-2022 08:30 AM - edited 05-11-2022 08:44 AM
does anyone have a working script that will install Google Chrome web browser (universal)?
I'm using this old script but i've recently noticed on both Intel & M1 it's now not installing the most current Google Chrome version of 101.***. it's installing at version 98.*****
I'm testing that script from @Geissbuhler
Posted on 08-15-2022 11:15 AM
Thanks for this script @Geissbuhler . We ran into an issue where Chrome wouldn't autoupdate on our MacBooks. We don't give the staff local admin so they weren't able to do the reinstall that the Macs were requiring them to do. Set the script up in Self Service and it runs flawlessly for this.