Worklet: Install Discord client on Mac

This worklet will check to see if Discord is installed and if it isn’t, will download and install it.

See this KB article for how to setup a worklet:

Evaluation Code:

#!/bin/bash

if [ -d "/Applications/Discord.app" ]; then
    exit 0
else
    exit 1
fi

Remediation Code:

#!/bin/bash

echo -e "Downloading Discord..."
curl -L -o "/tmp/Discord.dmg" https://discordapp.com/api/download?platform=osx

echo -e "Installing Discord..."
hdiutil attach "/tmp/Discord.dmg" -nobrowse
ditto "/Volumes/Discord/Discord.app" "/Applications/Discord.app"

echo -e "Cleaning up..."
hdiutil detach "/Volumes/Discord"
rm -f "/tmp/Discord.dmg"
2 Likes