All posts by Dan Ashley

SCRIPT | Install-Firefox-Latest

Install Firefox

Summary

This script will install the latest version of Firefox.


Script Content

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
dmgname="Firefox.dmg"
dmglink="http://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US"
dmgmountedname="Firefox"
apptoreplace="Firefox.app"
apptoreplacerunningname="Firefox"

# Download DMG
curl -L -o $dmgname "$dmglink"

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset netname
exit 0

Concluding Comments

Firefox is a common web browser often used as an alternative to either Google Chrome of Safari for macOS users. This script allows you to know the latest version is always being deployed.

SCRIPT | Install-Figma-Latest

Install Figma

Summary

These scripts will install the latest version of Figma.

Please note there is 2 versions of the script. One is for installing the arm64 version of the application intended for Macs with an Apple Silicon CPU, the other script installs the x86_64 version of the app for Macs with an Intel CPU.


Script Content (for Apple Silicon CPU Macs – arm64)

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
zipname="Figma.zip"
ziplink="https://desktop.figma.com/mac-arm/Figma.zip"
apptoreplace="Figma.app"
apptoreplacerunningname="Figma"
apptoreplacerunningname="FigmaAgent"

# Download ZIP
curl -L -o $zipname "$ziplink"

# Remove any previous downloaded remnants
rm -rf $apptoreplace
rm -rf "__MACOSX"

# Unzip ZIP
unzip $zipname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"
killall -Kill "$apptoreplacerunningname2"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Remove the downloaded App
rm -rf $apptoreplace
rm -rf "__MACOSX"

# Clear out the used variables
unset zipname
unset ziplink
unset apptoreplace
unset apptoreplacerunningname
unset apptoreplacerunningname2
unset netname
exit 0

Script Content (for Intel CPU Macs – x86_64)

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
zipname="Figma.zip"
ziplink="https://desktop.figma.com/mac/Figma.zip"
apptoreplace="Figma.app"
apptoreplacerunningname="Figma"
apptoreplacerunningname="FigmaAgent"

# Download ZIP
curl -L -o $zipname "$ziplink"

# Remove any previous downloaded remnants
rm -rf $apptoreplace
rm -rf "__MACOSX"

# Unzip ZIP
unzip $zipname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"
killall -Kill "$apptoreplacerunningname2"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Remove the downloaded App
rm -rf $apptoreplace
rm -rf "__MACOSX"

# Clear out the used variables
unset zipname
unset ziplink
unset apptoreplace
unset apptoreplacerunningname
unset apptoreplacerunningname2
unset netname
exit 0

Concluding Comments

Figma is a vector graphics editor and prototyping tool which is primarily web-based, with additional offline features enabled by the desktop application for macOS.

SCRIPT | Install-Microsoft-Teams-Latest

Install Microsoft Teams

Summary

This script will install the latest version of Microsoft Teams.


Script Content

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Obtain URL for PKG
teamsurl="https://teams.microsoft.com/downloads/DesktopUrl?env=production&plat=osx&arch=64"

# Update variables. These shouldn't need to change for each update
pkgname="Teams_osx.pkg"
pkglink=$(curl -s "$teamsurl")
apptoupdaterunningname="Microsoft Teams"

# Download PKG
curl -L -o "$pkgname" "$pkglink"

sleep 10

# Kill the app if it is running
killall -Kill "$apptoupdaterunningname"

# Install PKG
sudo installer -pkg $pkgname -target /

# Remove the downloaded PKG
rm $pkgname

# Clear out the used variables
unset teamsurl
unset pkgname
unset pkglink
unset apptoupdaterunningname
exit 0

Concluding Comments

Microsoft Teams is pretty much an essential application for any enterprise user these days, this script allow you to know the latest version is always being deployed.

SCRIPT | Management-Update-User-Information

Update User Information

Summary

This script updates the assigned user in Jamf Pro based off who is logged in.


Script Content

#!/bin/zsh

# Get the logged in users username
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

echo "Running recon for $loggedInUser `date`..."
sudo jamf recon -endUsername $loggedInUser
echo "Finished running recon for $loggedInUser `date`..."

Concluding Comments

This task will assist with maintaining accurate records within Jamf Pro of which Mac is assigned to which user.

SCRIPT | Install-Slack-Latest

Install Slack

Summary

This script will install the latest Universal version of Google Chrome.


Script Content

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
dmgname="Slack.dmg"
dmglink="https://slack.com/ssb/download-osx-universal"
apptoreplace="Slack.app"
apptoreplacerunningname="Slack"

# Download DMG
curl -L -o $dmgname "$dmglink"

# Mount DMG 
hdiutil mount -nobrowse $dmgname

#Slack DMG now has changing DMG name. Grab it on the fly as it's mounted
dmgmountedname=`ls /Volumes/ | grep "Slack"`

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"
  
sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset netname
exit 0

Concluding Comments

Slack is pretty much an essential application for any user these days, this script allow you to know the latest version is always being deployed.

As this script installs the Universal version of Slack, it will natively run on Macs with either Intel (x86_64) or Apple Silicon (arm64) CPUs.

SCRIPT | Install-Dropbox-Latest

Install Dropbox

Summary

This script will install the latest version of Dropbox.


Script Content

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Set variables. These shouldn't need to change for each update
dmgname="DropBoxInstaller.dmg"
dmglink="https://www.dropbox.com/download?full=1&plat=mac"
dmgmountedname="Dropbox Offline Installer"
apptoreplace="Dropbox.app"
apptoreplacerunningname="Dropbox"
apptorun="/Applications/Dropbox.app"

# Download DMG
curl -L $dmglink > $dmgname

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Update permissions on the copied APP in Applications
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Complete application install and initial setup
open "$apptorun"

unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset apptorun
unset netname

exit 0

Concluding Comments

The Dropbox desktop application makes sync’ing Dropbox contents to and from your Mac easier than ever.

SCRIPT | Install-Dialpad-Latest

Install Dialpad

Summary

This script will install the latest version of Dialpad.


Script Content

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
dmgname="Dialpad.dmg"
dmglink="https://storage.googleapis.com/dialpad_native/osx/Dialpad.dmg"
dmgmountedname="Dialpad"
apptoreplace="Dialpad.app"
apptoreplacerunningname="Dialpad"

# Download DMG
curl -L -O "$dmglink"

# Mount DMG 
hdiutil mount -nobrowse $dmgname

# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"

# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"

# Copy the new version into the Applications Folder
cp -R "/Volumes/$dmgmountedname/$apptoreplace" /Applications

# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`

chown -R ${netname}:Staff && chmod -R 755 "/Applications/$apptoreplace"

sudo xattr -rc "/Applications/$apptoreplace/"

# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"

# Remove the downloaded DMG
rm $dmgname

# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset netname
exit 0

Concluding Comments

The Dialpad desktop application allows you to make and receive phone calls via your computer.

SCRIPT | Install-Box-Drive-Latest

Install Box Drive

Summary

This script will install the latest version of Box Drive.


Script Content

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
pkgname="Box.pkg"
pkglink="https://e3.boxcdn.net/box-installers/desktop/releases/mac/Box.pkg"
apptoupdaterunningname="Box"

# Download PKG
curl -L -o "$pkgname" "$pkglink"

sleep 10

# Kill the app if it is running
killall -Kill "$apptoupdaterunningname"

# Install PKG
sudo installer -pkg $pkgname -target /

# Remove the downloaded PKG
rm $pkgname

# Clear out the used variables
unset pkgname
unset pkglink
unset apptoupdaterunningname
exit 0

Concluding Comments

The Box Drive desktop application makes sync’ing Box Drive contents to and from your Mac easier than ever.

SCRIPT | Install-Google-Chrome-Latest

Install Google Chrome

Summary

This script will install the latest Universal version of Google Chrome.


Script Content

#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"

# Update variables. These shouldn't need to change for each update
pkgname="googlechrome.pkg"
pkglink="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"
apptoupdaterunningname="Google Chrome"

# Download PKG
curl -L -o "$pkgname" "$pkglink"

sleep 10

# Kill the app if it is running
killall -Kill "$apptoupdaterunningname"

# Install PKG
sudo installer -pkg $pkgname -target /

# Remove the downloaded PKG
rm $pkgname

# Clear out the used variables
unset pkgname
unset pkglink
unset apptoupdaterunningname
exit 0

Concluding Comments

Google Chrome is pretty much an essential application for any user, this script allows you to know the latest version is always being deployed.

As this script installs the Universal version of Google Chrome, it will natively run on Macs with either Intel (x86_64) or Apple Silicon (arm64) CPUs.

SCRIPT | Install-Apple-Rosetta2

Install Apple Rosetta 2

Summary

This script will install Apple Rosetta 2 on a Mac with an Apple Silicon CPU.


Script Content

#!/bin/zsh

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

exit 0

Concluding Comments

When deploying Macs with Apple Silicon CPUs, this script is an essential tool for ensuring any applications written specifically for Intel x86_64 CPUs are able to run.