Deploying Messenger to Mac
Messenger is available as a dmg for Mac for easy deployment via shell script or for mass deployment via your favorite RMM, MDM, or other deployment solution.
1. Finished setting up messenger.
2. Understand the difference between Partner-level and Customer-level deployments.
About Messenger for Mac
Messenger lives in the tray and by default will auto start with your Mac. To open the app, find the icon in your tray and open it. It will inherit the tray icon that you define in your Messenger settings.
Deploying via Shell
Retrieving your App ID
You will need an App ID to deploy Messenger for your customers - this tells messenger to inherit your branding.
You can retrieve your partner-level App ID from the Thread Admin Panel -> Messenger -> Installation.
Recommended Shell Script
Save as a .sh script.
#!/bin/bash
# Exit the script on any command failure
set -e
set -o pipefail
# Log file
LOG_PATH="/tmp/messenger_install.log"
# macOS username
if [ -n "$SUDO_USER" ]; then
USERNAME="$SUDO_USER"
else
USERNAME=$(whoami)
fi
MESSENGER_CONFIG="/Users/$USERNAME/Library/Application Support/Messenger"
# Function to log messages
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_PATH"
}
log "username: $USERNAME"
# Variables
DOWNLOAD_URL="https://assets.getthread.com/messenger/downloads/desktop/messenger.dmg"
DMG_PATH="/tmp/messenger.dmg"
MOUNT_PATH="/tmp/messenger_mount"
APP_ID="ENTER YOUR APP ID HERE"
log "Starting installation of Messenger app..."
# Uninstall existing Messenger apps
rm -rf /Applications/Messenger.app && rm -rf /Applications/Chatgenie\ Messenger.app
# Download the DMG file
log "Downloading DMG from $DOWNLOAD_URL..."
curl -o "$DMG_PATH" "$DOWNLOAD_URL"
log "DMG downloaded to $DMG_PATH."
# Function to unmount the DMG
function unmount_dmg {
log "Unmounting DMG from $MOUNT_PATH..."
hdiutil detach "$MOUNT_PATH" || true
log "DMG unmounted."
}
# Mount the DMG
log "Mounting DMG..."
hdiutil attach "$DMG_PATH" -mountpoint "$MOUNT_PATH"
log "DMG mounted at $MOUNT_PATH."
# Trap any error and ensure that the DMG gets unmounted even if there's an error
trap unmount_dmg EXIT
# Install the app
log "Installing Messenger app to /Applications..."
cp -R "$MOUNT_PATH"/*.app /Applications/
log "Installation complete."
# Unmount the DMG
unmount_dmg
# Remove the downloaded DMG to clean up
log "Removing downloaded DMG..."
rm "$DMG_PATH"
log "DMG removed."
# Close any running instances of the app
log "Closing any running instances of the Messenger app..."
pkill -f "Messenger.app/Contents/MacOS/Messenger" || true
log "Instances closed."
# Configure app id
if [ -d "$MESSENGER_CONFIG" ]; then
log "Messenger config folder exists for user $USERNAME."
echo '{ "APP_ID": "'"$APP_ID"'" }' > "$MESSENGER_CONFIG/config.json"
log "Configured Messenger app ID in $MESSENGER_CONFIG/config.json."
else
log "Messenger config folder not found for user $USERNAME."
fi
# Run the nohup command to configure the app
log "Configuring the Messenger app..."
nohup /Applications/Messenger.app/Contents/MacOS/Messenger APP_ID="$APP_ID" FLOW=customer &
log "Configuration initiated."
# Allow a brief moment for configuration to complete
sleep 2
# Launch the app
log "Launching the Messenger app..."
open -a Messenger
log "Messenger app launched."
# Script finished
log "Messenger app installation and configuration complete!"
Executing the Shell Script
To execute the above script on a Mac, first download your script as a .sh file (see above). Then open terminal and run the following commands:
cd ~/Downloads
chmod +x messenger_mac.sh
./messenger_mac.sh