Skip to main content

Just in case anyone needs this I wanted to post it for an updated resource.

#!/bin/bash # Script Name: Disable Slack updates.sh # Author: [Michael Cleveland] # Created On: [Creation Date, e.g., 2023-10-31] # Last Modified By: [Michael Cleveland] # Last Modified On: [2023-10-31] # Version: 1.0 # Description: # This script modifies the Slack application's preferences for the currently logged-in user on macOS. # It specifically sets the 'SlackNoAutoUpdates' key to 'true', which prevents the Slack app from auto-updating. # Usage: # Ensure that Slack is not running or is restarted after this script runs to apply the changes. # Note: # This script uses PlistBuddy for editing plist files, as it ensures the file's integrity. # Be cautious when editing plist files and always ensure backups are made before script execution. # [Here starts the actual script code] echo "Starting the update of Slack preferences..." # Get the current logged-in user USER=$(stat -f %Su /dev/console) # Path to the .plist file plist_file="/Users/$USER/Library/Preferences/com.tinyspeck.slackmacgap.plist" # Key and value to be added/checked key="SlackNoAutoUpdates" expected_value="true" # Check if the key exists and has the expected value current_value=$(/usr/libexec/PlistBuddy -c "Print :$key" "$plist_file" 2>/dev/null) if [[ $? -eq 0 && "$current_value" == "$expected_value" ]]; then echo "The key '$key' already exists with the value '$expected_value'. No changes needed." else # Check if the key exists regardless of its value if [[ $? -eq 0 ]]; then echo "The key '$key' exists but with a different value. Updating it to '$expected_value'." /usr/libexec/PlistBuddy -c "Set :$key $expected_value" "$plist_file" else echo "The key '$key' does not exist. Adding it with the value '$expected_value'." /usr/libexec/PlistBuddy -c "Add :$key bool $expected_value" "$plist_file" fi fi echo "Script execution completed."

Source: https://slack.com/help/articles/360035635174-Deploy-Slack-for-macOS

That didnt work for me, but this did

#!/bin/bash # https://slack.com/intl/en-gb/help/articles/360035635174-Deploy-Slack-for-macOS echo "$(date) Disabling Slack AutoUpdates" # GET ALL THE REAL ACCOUNTS ON THE MACHINE userName=$(dscl . list /Users | grep -v "^_" | grep -v "^root" | grep -v "^daemon" | grep -v "^nobody" | grep -v "^Guest" | grep -v "^com.apple.calendarserver") for GET_USERS in $userName ;do echo "$(date) Disabling slack autoupdates for $GET_USERS" su $GET_USERS -l -c 'touch ~/Library/Preferences/com.tinyspeck.slackmacgap.plist' 2>/dev/null su $GET_USERS -l -c 'defaults write ~/Library/Preferences/com.tinyspeck.slackmacgap SlackNoAutoUpdates -bool YES' 2>/dev/null done exit 0