Some Simple Shell Scripts to Install Mac Apps for Intune

Here are some typical shell script codes for mac application installation

#!/bin/bash

# Check if Rosetta has been installed

if [ $(/usr/bin/pgrep oahd) ]; then 
	echo 'rosetta installed' 
else
	/usr/sbin/softwareupdate --install-rosetta --agree-to-license
fi

# Download the installer and Unzip
cd /tmp
curl -o ./xxx.zip https://xxx.com/xxx.zip
unzip -o -j -d /tmp/ xxx.zip

# Do the install for pkg installer
sudo installer -pkg /tmp/xxx.pkg -target /

# Install DMG package
# You only need the following code if if requires a manual click yes for the license, otherwise remove yes|PAGER=cat

yes | PAGER=cat  hdiutil attach /tmp/xxx.dmg
cp -rf /Volumes/xxx*.app /Applications
hdiutil detach -force  /Volumes/xxx/
# Do the cert install and trust
sudo security add-trusted-cert -d -r trustAsRoot -k /Library/Keychains/System.Keychain /tmp/ndes_cert.cer
rm /tmp/ndes_cert.cer
# Check if EasyEdit already installed with version 0.3.6
VERSION=$(defaults read /Applications/EasyEdit.app/Contents/Info.plist CFBundleShortVersionString)
echo "the current EasyEdit version is $VERSION"

if [ "$VERSION" = "0.3.6" ]; then
    echo "The installer cannot proceed, versioin is 0.3.6"
    exit 1
fi

# Close EasyEdit App
killall EasyEdit

cd /tmp
curl -o ./EasyEdit.zip https://xxx.com/EasyEdit-0.3.6-mac.zip
unzip -o -d /Applications/ EasyEdit.zip

1 thought on “Some Simple Shell Scripts to Install Mac Apps for Intune”

  1. Hey i came across this post and thank you! i am having some trouble trying to install rapid7.sh into macs using Intune, is it possible you can make a video or post on how to do it? it seems like you have to have the installer agent stored in a storage account and use a curling script to do an install but i am totally new to this methods and haven’t found a clear answer for it.

    Reply

Leave a Comment