Worklet: Ensuring Firefox is installed on Mac devices

Userlevel 5

This worklet will evaluate Mac devices to ensure the latest version of Firefox is installed. If the worklet finds the Firefox applications is not installed, the remediation code will install it on the device.


#example script for installing Firefox on Mac devices

#evaluate the device to see if Firefox is currently installed.
if [ -d "/Applications/" ]; then
exit 0
exit 1


#example script for installing Firefox on Mac devices

#create a temporary directory to download Firefox install file
set -e

#download the latest version of Firefox to the temp file
echo "Downloading Firefox..."
curl -L "" -o "$tempfile"
echo "Installing Firefox..."

#mount the firefox dmg file to a volume
hdiutil attach /tmp/Firefox.dmg

#copy the firefox app to the devices applications
cp -R /Volumes/Firefox/ /Applications/

#remove tmp file and unmount the image from the volume
echo "Cleaning up..."

hdiutil detach /Volumes/Firefox/ -quiet
sleep 2

rm -f "$tempfile"

This topic has been closed for comments

23 replies

Two things caught my eye:

“Google” looks wrong?

And the URL to get the most recent version of Firefox for OS X would be something like so:

Userlevel 7

It looks like Adam is pulling from their CDN directly, which might explain the different URL.

Userlevel 7

I think you’re right on the “Google” - I’ll fix that to just say “”

Userlevel 5

I typed that in by accident when adding comments. Please make the change.

Userlevel 5

Made the change

Userlevel 7

Thanks @awhitman!

Userlevel 5

This is correct, but I can update it to the Mozilla URL

I wonder if the CDN has a most recent URL too. I went by the instructions that I found on their FTP server. Old school.

Userlevel 5

had issues curling the latest version URL. Direct pull from CDN and I will update the latest URL link

Userlevel 5

This is for the .exe which would work. Just need to change the syntax to run the .exe instead of mounting the .dmg to a volume.

Userlevel 7

It’s already live - people are getting to see the sausage made in real time 🙂

This cURL command worked for me. But I did not try it in the sausage machine.

curl “” > “Firefox.dmg”

Userlevel 5

Worked for me too! Must have clicked the wrong link. Made the change and tested it. Should be good to go!

Userlevel 7

And that is how quickly we fix stuff at Automox 🙂

Thanks for the speedy response guys!

Sudo isn’t required in this context as the agent runs as root user. It will actually change the environment if you use it here.

That curl command will return an HTML document as that address is a CDN so you need to follow links with curl -L <address>

hdiutil can return errors if that URL returns a bad value and may not error the way you like.

Shouldn’t the remediation script also return 1 or 0?

Hi, I am trying to use the firefox worklet but I am getting this error:

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0/Library/Application Support/Automox/execDir080237696/execcmd361802207: line 12: 1”: command not found curl: (6) Could not resolve host: “https

That is strange. The error implies that curl is not on the machine, but the output for the first piece is the status in curl.

% Total % Received % Xferd Average Speed Time....

Let me see if I can reproduce this behavior.

Userlevel 5

Could you check to make sure cURL is installed on the OS?

run the command curl --help and see if it returns with the help option for curl. If not, then it isn’t installed on your Mac’s OS.

To install curl follow these instructions

Once installed, try to run the Firefox install Worklet again.

If that does not work, It maybe a bad cURL install, which is why it shows the curl output in the first piece. Try to uninstall, and reinstall.

I also see Could not resolve host: “https at the end of the stderr snippet you have. This usually means that there is an issue connecting to the host provided in the curl. Can you confirm your mac device can connect to and see if it download the Firefox .dmg?

Hi Yes curl is installed.

the mac os version is 10.15.4

and yes I can run the curl download manually just fine.

thank you

Userlevel 4


check out this post regarding an identical issue. In the OPs case, it was DNS configuration, which is what your message alludes to when it states the URL is not found.

Userlevel 7

Or you can consult this handy website which will tell you if the problem is DNS related:

(note: this is a joke website 🙂 )

Hi, the strange think is if I run it manually using terminal then it downloads fine.

Userlevel 7

That’s probably because the terminal is running as you whereas what comes through Automox is running as root. Differences in the environment variables could be throwing a wrench in things.