Skip to content

Instantly share code, notes, and snippets.

@alexlee002
Created April 11, 2015 19:50
Show Gist options
  • Save alexlee002/b87dbeac1f9fd896174b to your computer and use it in GitHub Desktop.
Save alexlee002/b87dbeac1f9fd896174b to your computer and use it in GitHub Desktop.
Auto update Xcode plugins to support new version of Xcode
#!/bin/sh
PLUGINS_DIR="$HOME/Library/Application Support/Developer/Shared/Xcode/Plug-ins"
XCODE_INFO_PATH=$(xcode-select -p)
XCODE_INFO_PATH=$(dirname "$XCODE_INFO_PATH")/Info
DVTPlugInCompatibilityUUID=$(defaults read "$XCODE_INFO_PATH" DVTPlugInCompatibilityUUID)
for plugin in "$PLUGINS_DIR"/*.xcplugin; do
plugin_info_path="$plugin/Contents/Info"
if [[ -f "$plugin_info_path.plist" ]]; then
count=$(defaults read "$plugin_info_path" DVTPlugInCompatibilityUUIDs | grep $DVTPlugInCompatibilityUUID | wc -l)
if [[ $count -eq 0 ]]; then
echo "add compatibility UUID to \033[31m$(basename "$plugin")\033[0m"
defaults write "$plugin_info_path" DVTPlugInCompatibilityUUIDs -array-add $DVTPlugInCompatibilityUUID
fi
fi
done
echo "Done! please restart your Xcode~"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment