Last active
May 17, 2019 08:54
-
-
Save mokagio/b9a03486d46f8610ad99 to your computer and use it in GitHub Desktop.
Script updating all plugins to be compatible with the latest Xcode and Xcode-beta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Updates all plug-ins to be compatible with the latest Xcode and Xcode-beta | |
# | |
plugins_location="~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins" | |
# Get Xcode's version | |
current_xcode_version="$(defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID)" | |
# Get Xcode-beta's version, if any | |
if [ -e /Applications/Xcode-beta.app ]; then | |
current_xcode_beta_version="$(defaults read /Applications/Xcode-beta.app/Contents/Info DVTPlugInCompatibilityUUID)" | |
fi | |
# I haven't found a better way to get all the files in the plug-ins folder due | |
# to the space in the path, and my ignorance in shell scripting | |
for plugin in $(eval "ls $plugins_location") | |
do | |
echo -n "Updating $plugin..." | |
# Add the current Xcode's version to the array of compatible versions for | |
# the plugin | |
eval "defaults write $plugins_location/$plugin/Contents/Info DVTPlugInCompatibilityUUIDs -array-add $current_xcode_version" | |
# Do the same for Xcode-beta, if any | |
if [ $current_xcode_beta_version ]; then | |
eval "defaults write $plugins_location/$plugin/Contents/Info DVTPlugInCompatibilityUUIDs -array-add $current_xcode_beta_version" | |
fi | |
echo " ✅" | |
done | |
echo -e "\nAll done 👍 \nRemember restart Xcode to see your plugins." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, but you might probably want to simplify things a bit by: