Worklet: Install Microsoft Office on MacOS

Hi all,

Here is a method to install Microsoft Office 365 via a Worklet.

Basically it checks whether Word, Excel, PowerPoint and Outlook are installed, if not, it then downloads the pkg for MS Office which I got from https://macadmins.software/ and then installs from the /tmp/ directory, then removes the installer. You may want to change the download link if it expires or doesn’t work.

Evaluation:

#!/bin/bash

#Checks whether these .apps are installed in the /Applications directory, if not, Exit 1 code and goes to next step

if [[ -d /Applications/Microsoft\ Word.app && -d /Applications/Microsoft\ Excel.app && -d /Applications/Microsoft\ PowerPoint.app && -d /Applications/Microsoft\ Outlook.app ]]; then
        echo "Microsoft Office is installed."
        exit 0
else
        echo "Microsoft Office is not installed."
        exit 1
fi

Remediation:

#!/bin/bash

echo -e "Downloading Microsoft Office..."

#Downloads MS Office pkg to /tmp/

curl -L -o "/tmp/mspkg.pkg" https://go.microsoft.com/fwlink/?linkid=525133

echo -e "Installing Microsoft Office..."

#Runs the installer

sudo installer -pkg /tmp/mspkg.pkg -target /

echo -e "Cleaning up..."
rm -f "/tmp/mspkg.pkg"