Skip to content

Instantly share code, notes, and snippets.

@tofrankie
Last active April 16, 2026 21:59
Show Gist options
  • Select an option

  • Save tofrankie/63378b9ba2c3d4393223feb0de1e0ac9 to your computer and use it in GitHub Desktop.

Select an option

Save tofrankie/63378b9ba2c3d4393223feb0de1e0ac9 to your computer and use it in GitHub Desktop.
Fix Sourcetree icon on macOS
#!/bin/bash
# From: https://jira.atlassian.com/browse/SRCTREE-8221
# Go to the current user's Downloads directory
cd ~/Downloads
# Download a copy of the previous version of Sourcetree
curl -LO 'https://product-downloads.atlassian.com/software/sourcetree/ga/Sourcetree_4.2.16_307.zip'
# Unpack and remove the Zip archive
unzip -q ./Sourcetree_4.2.16_307.zip && rm ./Sourcetree_4.2.16_307.zip
# Generate a new Finder icon file from the old Sourcetree icon
# Rez will exit with an error but still write the resource fork
echo "read 'icns' (-16455) \"./Sourcetree.app/Contents/Resources/sourcetree.icns\";" | \
{ Rez -o "$(printf '/Applications/Sourcetree.app/Icon\r')" 2>/dev/null || true ; }
# Set the Finder's Custom icon flag on the application
SetFile -a C /Applications/Sourcetree.app
# Clean up the downloaded copy of Sourcetree
rm -rf ./Sourcetree.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment