Hi all
Being a newbie please be gentle.
I have found and used the Flash update script on this site and was wondering if there is a way of doing similar qwith Firefox - script downloads and installs the latest Firefox for compatible Macs
kind regards
john
- Home
- Community
- Get Support
- General Discussions
- Firefox update script
Firefox update script
- January 7, 2015
- 56 replies
- 41 views

- New Contributor
- 1 reply
56 replies
- Honored Contributor
- 336 replies
- January 28, 2015
@mm2270 still no luck with Reader, but Dropbox and Cyberducky work flawlessly.
Side note, any chance you're working on a way to install multiple at once? This would be quite a time saver as a script to run when we image machines.

- Contributor
- 29 replies
- March 23, 2015

- Contributor
- 51 replies
- March 23, 2015
@joe.farage, I love your Adobe Air and Reader scripts, so thanks! Any chance you have the Firefox one for ESR? I've been trying to modify your script with no luck so far.
- Legendary Contributor
- 7886 replies
- March 23, 2015
@pearlin You can take a look at my script here which can do similar things for a variety of products, although not for Adobe Air at the moment.
I will be releasing a pretty major rewrite of this script pretty soon, that will have a bunch of new features. Its in beta testing right now with a few folks, so if you decide you'd like to use it and want to participate to help catch any issues, be sure to request that.
- Legendary Contributor
- 7886 replies
- March 23, 2015
@pearlin Can you send me an email at mm2270 [at] me [dot] com? I can get you the beta script to test with sometime later today along with a list of the changes made to it.

- Contributor
- 29 replies
- March 24, 2015
Hi all, hi @pearlin
Here is the deployment script for Firefox ESR. Enjoy ;)
1#!/bin/sh2#####################################################################################################3#4# ABOUT THIS PROGRAM5#6# NAME7# FirefoxESRInstall.sh -- Installs or updates Firefox ESR8#9# SYNOPSIS10# sudo FirefoxInstallESR.sh11#12####################################################################################################13#14# HISTORY15#16# Version: 1.017#18# - Joe Farage, 23.03.201519#20####################################################################################################21# Script to download and install Firefox.22# Only works on Intel systems.23#24# choose language (en-US, fr, de). Default language: en-US25lang=""26# CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 1 AND, IF SO, ASSIGN TO "lang"27if [ "$4" != "" ] && [ "$lang" == "" ]; then28 lang=$429else 30 lang="en-US"31fi3233dmgfile="FF_ESR.dmg"34logfile="/Library/Logs/FirefoxESRInstallScript.log"3536# Are we running on Intel?37if [ '`/usr/bin/uname -p`'="i386" -o '`/usr/bin/uname -p`'="x86_64" ]; then38 ## Get OS version and adjust for use with the URL string39 OSvers_URL=$( sw_vers -productVersion | sed 's/[.]/_/g' )4041 ## Set the User Agent string for use with curl42 userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X ${OSvers_URL}) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2"4344 # Get the latest version of Firefox ESR available from Firefox page.45 latestver=`/usr/bin/curl -s -A "$userAgent" https://download-installer.cdn.mozilla.net/pub/firefox/releases/latest-esr/mac/${lang}/ | grep 'Firefox%20.*esr.dmg' | sed 's/.*Firefox%20//' | sed 's/esr.dmg.*//' | /usr/bin/awk '{print $1}'`46 echo "Language: $lang"47 echo "Latest Version is: $latestver"4849 # Get the version number of the currently-installed FF, if any.50 if [ -e "/Applications/Firefox.app" ]; then51 currentinstalledver=`/usr/bin/defaults read /Applications/Firefox.app/Contents/Info CFBundleShortVersionString`52 echo "Current installed version is: $currentinstalledver"53 if [ ${latestver} = ${currentinstalledver} ]; then54 echo "Firefox is current. Exiting"55 exit 056 fi57 else58 currentinstalledver="none"59 echo "Firefox is not installed"60 fi6162 url="https://download-installer.cdn.mozilla.net/pub/firefox/releases/latest-esr/mac/${lang}/Firefox%20${latestver}esr.dmg"6364 echo "Latest version of the URL is: $url"65 echo "`date`: Download URL: $url" >> ${logfile}6667 # Compare the two versions, if they are different or Firefox is not present then download and install the new version.68 if [ "${currentinstalledver}" != "${latestver}" ]; then69 /bin/echo "`date`: Current Firefox version: ${currentinstalledver}" >> ${logfile}70 /bin/echo "`date`: Available Firefox version: ${latestver}" >> ${logfile}71 /bin/echo "`date`: Downloading newer version." >> ${logfile}72 /usr/bin/curl -s -o /tmp/${dmgfile} ${url}73 /bin/echo "`date`: Mounting installer disk image." >> ${logfile}74 /usr/bin/hdiutil attach /tmp/${dmgfile} -nobrowse -quiet75 /bin/echo "`date`: Installing..." >> ${logfile}76 ditto -rsrc "/Volumes/Firefox/Firefox.app" "/Applications/Firefox.app"7778 /bin/sleep 1079 /bin/echo "`date`: Unmounting installer disk image." >> ${logfile}80 /usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep Firefox | awk '{print $1}') -quiet81 /bin/sleep 1082 /bin/echo "`date`: Deleting disk image." >> ${logfile}83 /bin/rm /tmp/${dmgfile}8485 #double check to see if the new version got updated86 newlyinstalledver=`/usr/bin/defaults read /Applications/Firefox.app/Contents/Info CFBundleShortVersionString`87 if [ "${latestver}" = "${newlyinstalledver}" ]; then88 /bin/echo "`date`: SUCCESS: Firefox has been updated to version ${newlyinstalledver}" >> ${logfile}89 # /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -title "Firefox Installed" -description "Firefox has been updated." &90 else91 /bin/echo "`date`: ERROR: Firefox update unsuccessful, version remains at ${currentinstalledver}." >> ${logfile}92 /bin/echo "--" >> ${logfile}93 exit 194 fi9596 # If Firefox is up to date already, just log it and exit. 97 else98 /bin/echo "`date`: Firefox is already up to date, running ${currentinstalledver}." >> ${logfile}99 /bin/echo "--" >> ${logfile}100 fi 101else102 /bin/echo "`date`: ERROR: This script is for Intel Macs only." >> ${logfile}103fi104105exit 0

- Contributor
- 43 replies
- August 3, 2015
@joe.farage Is there an easy way to add support for multiple languages based on what language the OS is using?

- New Contributor
- 9 replies
- December 2, 2015
the ftp site is giving a 404 error now. I had to edit a similar script that had been working until recently.
here it is.
1#!/bin/sh2# updateFirefox.sh3#to determine if there's a update for Firefox and, if there is, deploy it4#5#to show script startup in maint_logfile6echo 'start updateFirefox.sh'7#89date10#1112ffv=$(/Applications/Firefox.app/Contents/MacOS/firefox -v)13set -- $ffv14ffvn=$315echo "Installed Firefox version is $ffvn"1617# somehow find current version18curl -O FireFox*.dmg "https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US" > /scripts/firefox.txt1920# parse text file to find dmg file name and version21nffvf=$(grep dmg /scripts/firefox.txt | sed 's/.*href="(.*.dmg).>.*/1/')22nffv=$(grep dmg /scripts/firefox.txt | sed 's/.*releases.(.*).mac.*/1/')2324echo "Latest Firefox version is $nffv"25if [[ "$ffvn" < "$nffv" ]] ; then26 echo Updating Firefox to $nffv from $ffvn27 #download actual dmg file28 echo Getting "$nffvf"29 sudo curl -o /scripts/Firefox.dmg "$nffvf"30 #mount dmg31 sudo hdiutil mount "/scripts/Firefox.dmg"32 if [ $? = 0 ]; then # if mount is successful33 #remove previous version of firefox34 sudo rm -rd /Applications/Firefox.app35 #install new version36 sudo cp -R /Volumes/Firefox/Firefox.app /Applications37 sleep 1538 #Unmount39 sudo hdiutil detach /Volumes/Firefox40# sudo hdiutil unmount /Volumes/Firefox41 sleep 542 fi43 #remove files44 sudo rm /scripts/Firefox.dmg4546fi47sudo rm /scripts/firefox.txt48echo 'end updateFirefox.sh'49exit 0

- New Contributor
- 9 replies
- December 2, 2015
edit out the sudo commands, they are not needed when run under the policy

- Honored Contributor
- 970 replies
- January 25, 2016
start updateFirefox.sh
Mon 25 Jan 2016 11:05:04 GMT
Installed Firefox version is 42.0
test.sh: line 18: /scripts/firefox.txt: No such file or directory
grep: /scripts/firefox.txt: No such file or directory
grep: /scripts/firefox.txt: No such file or directory
Latest Firefox version is
rm: /scripts/firefox.txt: No such file or directory
end updateFirefox.sh

- Honored Contributor
- 970 replies
- January 25, 2016
changed the path to /tmp
1#!/bin/sh2# updateFirefox.sh3#to determine if there's a update for Firefox and, if there is, deploy it4#5#to show script startup in maint_logfile6echo 'start updateFirefox.sh'7#89date10#1112ffv=$(/Applications/Firefox.app/Contents/MacOS/firefox -v)13set -- $ffv14ffvn=$315echo "Installed Firefox version is $ffvn"1617# somehow find current version18curl -O FireFox*.dmg "https://download.mozilla.org/?product=firefox-esr-latest&os=osx&lang=en-US" > /tmp/firefox.txt1920# parse text file to find dmg file name and version21nffvf=$(grep dmg /tmp/firefox.txt | sed 's/.*href="(.*.dmg).>.*/1/')22nffv=$(grep dmg /tmp/firefox.txt | sed 's/.*releases.(.*).mac.*/1/')2324echo "Latest Firefox version is $nffv"25if [[ "$ffvn" < "$nffv" ]] ; then26echo Updating Firefox to $nffv from $ffvn27#download actual dmg file28echo Getting "$nffvf"29curl -o /tmp/Firefox.dmg "$nffvf"3031#mount dmg32hdiutil mount -nobrowse "/tmp/Firefox.dmg"33if [ $? = 0 ]; then # if mount is successful3435#remove previous version of firefox36if [ -d /Applicarions/Firefox.app ]; then37rm -rd /Applications/Firefox.app38fi3940#install new version41cp -R /Volumes/Firefox/Firefox.app /Applications42sleep 1543#Unmount44hdiutil detach /Volumes/Firefox45sleep 546 fi4748#remove files49rm /tmp/Firefox.dmg5051fi52rm /tmp/firefox.txt53echo 'end updateFirefox.sh'54exit 0

- Contributor
- 57 replies
- July 27, 2016
I don't know if this would help at all being that it's a bit of an older thread but I found this page after digging around: https://download-installer.cdn.mozilla.net/pub/firefox/releases/latest/README.txt
Firefox actually tells you how to use wget to download the file, however that only works if you have wget installed on your machine. I was able to cobble together this cURL command to download the file:
1curl -GL -o Firefox.dmg -d "product=firefox-latest&os=osx&lang=en-US" https://download.mozilla.org/
I figured this would help is you're not using the ESR version and simply using the public version.
- Esteemed Contributor
- 1043 replies
- July 28, 2016
I took the script and wrapped it up in a Platypus app so users can see the output/progress. I also added a
1sleep 10
at the end to give users a chance to see the final status before it automatically closed. I then pushed the app to /Applications/Utilities/ and built a Policy to run
1/Applications/Utilities/Firefox_Updater.app/Contents/MacOS/Firefox Update
since it needs elevated rights to install the updates. Seems to work like a champ. I'm trying to find a downside to this though. Is there really?

- Contributor
- 57 replies
- July 28, 2016
@AVmcclint The only downside I could see is that if your company removes admin rights to their users then you'd have to temporarily elevate their permissions while the scripts run so that they can perform the update. I'm only thinking about that probably bc my company is looking to do that to a select group of users. Other than that, I can't think of a downside.
- Esteemed Contributor
- 1043 replies
- July 28, 2016
My users don't have admin rights. That's why I'm launching the app from a Policy so it runs as root.

- Contributor
- 57 replies
- July 28, 2016
@AVmcclint Duh. I should've thought of that. Ha. I was in the same mind set that Google runs their updater. You have to run it as the local user as it will bomb out complaining that it's being run by root. If FF lets the root user run the updater that's awesome! Then I retract my previous statement...I see no downside to this. :)
- Esteemed Contributor
- 1043 replies
- July 28, 2016
From what I can tell about this script is that it is completely independent of the Firefox application. One line in the script deletes the pre-existing copy of Firefox from /Applications. I added a line for pkill firefox
before the bulk of the script runs too to make sure there isn't any running processes that could object to being replaced.

- Contributor
- 53 replies
- November 11, 2016
So where is everyone with this? I had a FF ESR update script working last Spring, based on mm2270's wonderful work, but it quit working (I assume the problem with the FTP site?). All I want is something simple to put in Self Service for my users (non-admins) to be able to run on demand to update FF. Anyone have a working script for that with 10.11.6? I have had really bad luck with AutoPKG, so please stick with script-based solutions.
- Esteemed Contributor
- 1043 replies
- November 11, 2016
I'm using the script above with the modifications I noted. I did have to recently modify the script and redeploy it as a Self Service Policy so that it could get through our new web proxy. I'm not getting the ESR release, I'm only getting the regular public release you can download yourself from getfirefox.com. It seems to work well.
- Valued Contributor
- 338 replies
- November 29, 2016
Has anyone had trouble installing the ESR version over the top of a non-ESR version? I have a policy deploying ESR, but it doesn't want to replace the newer non-ESR version. I even set a custom trigger, and tried on my machine. Firefox wasn't open. I had version 49.0.2 installed. When the policy fired, it said it was successful, but checking the version info, it still said 49.0.2, and not 45.5.0.
Anyone seen this before?

- Esteemed Contributor
- 831 replies
- March 10, 2017
So I've applied an edit to use the Public releases for FireFox and the script seems to work great since the end result is an updated working version, but I get a curl error. Even with the following error everything seems to work. (I just don't like seeing errors though).
curl: Remote file name has no length!
curl: try 'curl --help' or 'curl --manual' for more information
Any ideas? Below is my full script built on the shoulders of @tkimpton built on the back of @dlang etc,etc,:
1#!/bin/sh2# updateFirefox.sh3#to determine if there's a update for Firefox and, if there is, deploy it4#5#to show script startup in maint_logfile6echo 'start updateFirefox.sh'7#89date10#1112ffv=$(/Applications/Firefox.app/Contents/MacOS/firefox -v)13set -- $ffv14ffvn=$315echo "Installed Firefox version is $ffvn"1617# somehow find current version18curl -O FireFox*.dmg "https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US" > /tmp/firefox.txt1920# parse text file to find dmg file name and version21nffvf=$(grep dmg /tmp/firefox.txt | sed 's/.*href="(.*.dmg).>.*/1/')22nffv=$(grep dmg /tmp/firefox.txt | sed 's/.*releases.(.*).mac.*/1/')2324echo "Latest Firefox version is $nffv"25if [[ "$ffvn" < "$nffv" ]] ; then26echo Updating Firefox to $nffv from $ffvn27#download actual dmg file28echo Getting "$nffvf"29curl -o /tmp/Firefox.dmg "$nffvf"3031#mount dmg32hdiutil mount -nobrowse "/tmp/Firefox.dmg"33if [ $? = 0 ]; then # if mount is successful3435#remove previous version of firefox36if [ -d /Applicarions/Firefox.app ]; then37rm -rd /Applications/Firefox.app38fi3940#install new version41cp -R /Volumes/Firefox/Firefox.app /Applications42sleep 1543#Unmount44hdiutil detach /Volumes/Firefox45sleep 546 fi4748#remove files49rm /tmp/Firefox.dmg5051fi52rm /tmp/firefox.txt53echo 'end updateFirefox.sh'54exit 0
Gabe Shackney
Princeton Public Schools

- Contributor
- 57 replies
- March 10, 2017
Just my two cents, but I use this as my cURL command:
1curl -GL -o Firefox.dmg -d "product=firefox-latest&os=osx&lang=en-US" https://download.mozilla.org/
I've have great luck then you don't need to worry about the version number of the current install for the sake of the cURL command, at least.

- Esteemed Contributor
- 831 replies
- March 10, 2017
Isn't the curl command though in my script writing the version number to a file to double check vs the installed version? Thats a part I like as a reference.
Gabe Shackney
Princeton Public Schools

- Contributor
- 79 replies
- June 6, 2017
I have an new script working.
You can download it from git hub:
firefox-esr-install.py
If you try it please let me know how it goes!
Thanks!
Hi all
Being a newbie please be gentle.
I have found and used the Flash update script on this site and was wondering if there is a way of doing similar qwith Firefox - script downloads and installs the latest Firefox for compatible Macs
kind regards
john
@mm2270 still no luck with Reader, but Dropbox and Cyberducky work flawlessly.
Side note, any chance you're working on a way to install multiple at once? This would be quite a time saver as a script to run when we image machines.
Hi all,
Here is a shell script to install or update Firefox: here
Same for Adobe Reader: here
Or Adobe AIR: here
Hope it helps ;)
Kind regards
joe
@joe.farage, I love your Adobe Air and Reader scripts, so thanks! Any chance you have the Firefox one for ESR? I've been trying to modify your script with no luck so far.
@pearlin You can take a look at my script here which can do similar things for a variety of products, although not for Adobe Air at the moment.
I will be releasing a pretty major rewrite of this script pretty soon, that will have a bunch of new features. Its in beta testing right now with a few folks, so if you decide you'd like to use it and want to participate to help catch any issues, be sure to request that.
@mm2270, thanks, I'm definitely interested in helping out!
@pearlin Can you send me an email at mm2270 [at] me [dot] com? I can get you the beta script to test with sometime later today along with a list of the changes made to it.
Hi all, hi @pearlin
Here is the deployment script for Firefox ESR. Enjoy ;)
1#!/bin/sh2#####################################################################################################3#4# ABOUT THIS PROGRAM5#6# NAME7# FirefoxESRInstall.sh -- Installs or updates Firefox ESR8#9# SYNOPSIS10# sudo FirefoxInstallESR.sh11#12####################################################################################################13#14# HISTORY15#16# Version: 1.017#18# - Joe Farage, 23.03.201519#20####################################################################################################21# Script to download and install Firefox.22# Only works on Intel systems.23#24# choose language (en-US, fr, de). Default language: en-US25lang=""26# CHECK TO SEE IF A VALUE WAS PASSED IN PARAMETER 1 AND, IF SO, ASSIGN TO "lang"27if [ "$4" != "" ] && [ "$lang" == "" ]; then28 lang=$429else 30 lang="en-US"31fi3233dmgfile="FF_ESR.dmg"34logfile="/Library/Logs/FirefoxESRInstallScript.log"3536# Are we running on Intel?37if [ '`/usr/bin/uname -p`'="i386" -o '`/usr/bin/uname -p`'="x86_64" ]; then38 ## Get OS version and adjust for use with the URL string39 OSvers_URL=$( sw_vers -productVersion | sed 's/[.]/_/g' )4041 ## Set the User Agent string for use with curl42 userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X ${OSvers_URL}) AppleWebKit/535.6.2 (KHTML, like Gecko) Version/5.2 Safari/535.6.2"4344 # Get the latest version of Firefox ESR available from Firefox page.45 latestver=`/usr/bin/curl -s -A "$userAgent" https://download-installer.cdn.mozilla.net/pub/firefox/releases/latest-esr/mac/${lang}/ | grep 'Firefox%20.*esr.dmg' | sed 's/.*Firefox%20//' | sed 's/esr.dmg.*//' | /usr/bin/awk '{print $1}'`46 echo "Language: $lang"47 echo "Latest Version is: $latestver"4849 # Get the version number of the currently-installed FF, if any.50 if [ -e "/Applications/Firefox.app" ]; then51 currentinstalledver=`/usr/bin/defaults read /Applications/Firefox.app/Contents/Info CFBundleShortVersionString`52 echo "Current installed version is: $currentinstalledver"53 if [ ${latestver} = ${currentinstalledver} ]; then54 echo "Firefox is current. Exiting"55 exit 056 fi57 else58 currentinstalledver="none"59 echo "Firefox is not installed"60 fi6162 url="https://download-installer.cdn.mozilla.net/pub/firefox/releases/latest-esr/mac/${lang}/Firefox%20${latestver}esr.dmg"6364 echo "Latest version of the URL is: $url"65 echo "`date`: Download URL: $url" >> ${logfile}6667 # Compare the two versions, if they are different or Firefox is not present then download and install the new version.68 if [ "${currentinstalledver}" != "${latestver}" ]; then69 /bin/echo "`date`: Current Firefox version: ${currentinstalledver}" >> ${logfile}70 /bin/echo "`date`: Available Firefox version: ${latestver}" >> ${logfile}71 /bin/echo "`date`: Downloading newer version." >> ${logfile}72 /usr/bin/curl -s -o /tmp/${dmgfile} ${url}73 /bin/echo "`date`: Mounting installer disk image." >> ${logfile}74 /usr/bin/hdiutil attach /tmp/${dmgfile} -nobrowse -quiet75 /bin/echo "`date`: Installing..." >> ${logfile}76 ditto -rsrc "/Volumes/Firefox/Firefox.app" "/Applications/Firefox.app"7778 /bin/sleep 1079 /bin/echo "`date`: Unmounting installer disk image." >> ${logfile}80 /usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep Firefox | awk '{print $1}') -quiet81 /bin/sleep 1082 /bin/echo "`date`: Deleting disk image." >> ${logfile}83 /bin/rm /tmp/${dmgfile}8485 #double check to see if the new version got updated86 newlyinstalledver=`/usr/bin/defaults read /Applications/Firefox.app/Contents/Info CFBundleShortVersionString`87 if [ "${latestver}" = "${newlyinstalledver}" ]; then88 /bin/echo "`date`: SUCCESS: Firefox has been updated to version ${newlyinstalledver}" >> ${logfile}89 # /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -title "Firefox Installed" -description "Firefox has been updated." &90 else91 /bin/echo "`date`: ERROR: Firefox update unsuccessful, version remains at ${currentinstalledver}." >> ${logfile}92 /bin/echo "--" >> ${logfile}93 exit 194 fi9596 # If Firefox is up to date already, just log it and exit. 97 else98 /bin/echo "`date`: Firefox is already up to date, running ${currentinstalledver}." >> ${logfile}99 /bin/echo "--" >> ${logfile}100 fi 101else102 /bin/echo "`date`: ERROR: This script is for Intel Macs only." >> ${logfile}103fi104105exit 0
@joe.farage Is there an easy way to add support for multiple languages based on what language the OS is using?
the ftp site is giving a 404 error now. I had to edit a similar script that had been working until recently.
here it is.
1#!/bin/sh2# updateFirefox.sh3#to determine if there's a update for Firefox and, if there is, deploy it4#5#to show script startup in maint_logfile6echo 'start updateFirefox.sh'7#89date10#1112ffv=$(/Applications/Firefox.app/Contents/MacOS/firefox -v)13set -- $ffv14ffvn=$315echo "Installed Firefox version is $ffvn"1617# somehow find current version18curl -O FireFox*.dmg "https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US" > /scripts/firefox.txt1920# parse text file to find dmg file name and version21nffvf=$(grep dmg /scripts/firefox.txt | sed 's/.*href="(.*.dmg).>.*/1/')22nffv=$(grep dmg /scripts/firefox.txt | sed 's/.*releases.(.*).mac.*/1/')2324echo "Latest Firefox version is $nffv"25if [[ "$ffvn" < "$nffv" ]] ; then26 echo Updating Firefox to $nffv from $ffvn27 #download actual dmg file28 echo Getting "$nffvf"29 sudo curl -o /scripts/Firefox.dmg "$nffvf"30 #mount dmg31 sudo hdiutil mount "/scripts/Firefox.dmg"32 if [ $? = 0 ]; then # if mount is successful33 #remove previous version of firefox34 sudo rm -rd /Applications/Firefox.app35 #install new version36 sudo cp -R /Volumes/Firefox/Firefox.app /Applications37 sleep 1538 #Unmount39 sudo hdiutil detach /Volumes/Firefox40# sudo hdiutil unmount /Volumes/Firefox41 sleep 542 fi43 #remove files44 sudo rm /scripts/Firefox.dmg4546fi47sudo rm /scripts/firefox.txt48echo 'end updateFirefox.sh'49exit 0
edit out the sudo commands, they are not needed when run under the policy
start updateFirefox.sh
Mon 25 Jan 2016 11:05:04 GMT
Installed Firefox version is 42.0
test.sh: line 18: /scripts/firefox.txt: No such file or directory
grep: /scripts/firefox.txt: No such file or directory
grep: /scripts/firefox.txt: No such file or directory
Latest Firefox version is
rm: /scripts/firefox.txt: No such file or directory
end updateFirefox.sh
changed the path to /tmp
1#!/bin/sh2# updateFirefox.sh3#to determine if there's a update for Firefox and, if there is, deploy it4#5#to show script startup in maint_logfile6echo 'start updateFirefox.sh'7#89date10#1112ffv=$(/Applications/Firefox.app/Contents/MacOS/firefox -v)13set -- $ffv14ffvn=$315echo "Installed Firefox version is $ffvn"1617# somehow find current version18curl -O FireFox*.dmg "https://download.mozilla.org/?product=firefox-esr-latest&os=osx&lang=en-US" > /tmp/firefox.txt1920# parse text file to find dmg file name and version21nffvf=$(grep dmg /tmp/firefox.txt | sed 's/.*href="(.*.dmg).>.*/1/')22nffv=$(grep dmg /tmp/firefox.txt | sed 's/.*releases.(.*).mac.*/1/')2324echo "Latest Firefox version is $nffv"25if [[ "$ffvn" < "$nffv" ]] ; then26echo Updating Firefox to $nffv from $ffvn27#download actual dmg file28echo Getting "$nffvf"29curl -o /tmp/Firefox.dmg "$nffvf"3031#mount dmg32hdiutil mount -nobrowse "/tmp/Firefox.dmg"33if [ $? = 0 ]; then # if mount is successful3435#remove previous version of firefox36if [ -d /Applicarions/Firefox.app ]; then37rm -rd /Applications/Firefox.app38fi3940#install new version41cp -R /Volumes/Firefox/Firefox.app /Applications42sleep 1543#Unmount44hdiutil detach /Volumes/Firefox45sleep 546 fi4748#remove files49rm /tmp/Firefox.dmg5051fi52rm /tmp/firefox.txt53echo 'end updateFirefox.sh'54exit 0
I don't know if this would help at all being that it's a bit of an older thread but I found this page after digging around: https://download-installer.cdn.mozilla.net/pub/firefox/releases/latest/README.txt
Firefox actually tells you how to use wget to download the file, however that only works if you have wget installed on your machine. I was able to cobble together this cURL command to download the file:
1curl -GL -o Firefox.dmg -d "product=firefox-latest&os=osx&lang=en-US" https://download.mozilla.org/
I figured this would help is you're not using the ESR version and simply using the public version.
I took the script and wrapped it up in a Platypus app so users can see the output/progress. I also added a
1sleep 10
at the end to give users a chance to see the final status before it automatically closed. I then pushed the app to /Applications/Utilities/ and built a Policy to run
1/Applications/Utilities/Firefox_Updater.app/Contents/MacOS/Firefox Update
since it needs elevated rights to install the updates. Seems to work like a champ. I'm trying to find a downside to this though. Is there really?
@AVmcclint The only downside I could see is that if your company removes admin rights to their users then you'd have to temporarily elevate their permissions while the scripts run so that they can perform the update. I'm only thinking about that probably bc my company is looking to do that to a select group of users. Other than that, I can't think of a downside.
My users don't have admin rights. That's why I'm launching the app from a Policy so it runs as root.
@AVmcclint Duh. I should've thought of that. Ha. I was in the same mind set that Google runs their updater. You have to run it as the local user as it will bomb out complaining that it's being run by root. If FF lets the root user run the updater that's awesome! Then I retract my previous statement...I see no downside to this. :)
From what I can tell about this script is that it is completely independent of the Firefox application. One line in the script deletes the pre-existing copy of Firefox from /Applications. I added a line for pkill firefox
before the bulk of the script runs too to make sure there isn't any running processes that could object to being replaced.
So where is everyone with this? I had a FF ESR update script working last Spring, based on mm2270's wonderful work, but it quit working (I assume the problem with the FTP site?). All I want is something simple to put in Self Service for my users (non-admins) to be able to run on demand to update FF. Anyone have a working script for that with 10.11.6? I have had really bad luck with AutoPKG, so please stick with script-based solutions.
I'm using the script above with the modifications I noted. I did have to recently modify the script and redeploy it as a Self Service Policy so that it could get through our new web proxy. I'm not getting the ESR release, I'm only getting the regular public release you can download yourself from getfirefox.com. It seems to work well.
Has anyone had trouble installing the ESR version over the top of a non-ESR version? I have a policy deploying ESR, but it doesn't want to replace the newer non-ESR version. I even set a custom trigger, and tried on my machine. Firefox wasn't open. I had version 49.0.2 installed. When the policy fired, it said it was successful, but checking the version info, it still said 49.0.2, and not 45.5.0.
Anyone seen this before?
So I've applied an edit to use the Public releases for FireFox and the script seems to work great since the end result is an updated working version, but I get a curl error. Even with the following error everything seems to work. (I just don't like seeing errors though).
curl: Remote file name has no length!
curl: try 'curl --help' or 'curl --manual' for more information
Any ideas? Below is my full script built on the shoulders of @tkimpton built on the back of @dlang etc,etc,:
1#!/bin/sh2# updateFirefox.sh3#to determine if there's a update for Firefox and, if there is, deploy it4#5#to show script startup in maint_logfile6echo 'start updateFirefox.sh'7#89date10#1112ffv=$(/Applications/Firefox.app/Contents/MacOS/firefox -v)13set -- $ffv14ffvn=$315echo "Installed Firefox version is $ffvn"1617# somehow find current version18curl -O FireFox*.dmg "https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US" > /tmp/firefox.txt1920# parse text file to find dmg file name and version21nffvf=$(grep dmg /tmp/firefox.txt | sed 's/.*href="(.*.dmg).>.*/1/')22nffv=$(grep dmg /tmp/firefox.txt | sed 's/.*releases.(.*).mac.*/1/')2324echo "Latest Firefox version is $nffv"25if [[ "$ffvn" < "$nffv" ]] ; then26echo Updating Firefox to $nffv from $ffvn27#download actual dmg file28echo Getting "$nffvf"29curl -o /tmp/Firefox.dmg "$nffvf"3031#mount dmg32hdiutil mount -nobrowse "/tmp/Firefox.dmg"33if [ $? = 0 ]; then # if mount is successful3435#remove previous version of firefox36if [ -d /Applicarions/Firefox.app ]; then37rm -rd /Applications/Firefox.app38fi3940#install new version41cp -R /Volumes/Firefox/Firefox.app /Applications42sleep 1543#Unmount44hdiutil detach /Volumes/Firefox45sleep 546 fi4748#remove files49rm /tmp/Firefox.dmg5051fi52rm /tmp/firefox.txt53echo 'end updateFirefox.sh'54exit 0
Gabe Shackney
Princeton Public Schools
Just my two cents, but I use this as my cURL command:
1curl -GL -o Firefox.dmg -d "product=firefox-latest&os=osx&lang=en-US" https://download.mozilla.org/
I've have great luck then you don't need to worry about the version number of the current install for the sake of the cURL command, at least.
Isn't the curl command though in my script writing the version number to a file to double check vs the installed version? Thats a part I like as a reference.
Gabe Shackney
Princeton Public Schools
I have an new script working.
You can download it from git hub:
firefox-esr-install.py
If you try it please let me know how it goes!
Thanks!
Reply
Related topics
FireFox install/update scripticon
General DiscussionsMozilla Firefox ESR update scripticon
General DiscussionsFirefox Install Script - Update Questionicon
General DiscussionsAutoPkgr Erroricon
General DiscussionsEnabling Firefox Autoupdates without Helper Tool prompt asking for Admin passwordicon
General Discussions
Most helpful members this week
- thebrucecarter
13 likes
- Chubs
11 likes
- tommypatzius
10 likes
- Alyoung
8 likes
- woaikonglong
8 likes
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Scanning file for viruses.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
OKThis file cannot be downloaded
Sorry, our virus scanner detected that this file isn't safe to download.
OKCookie 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
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.