Skip to content

Instantly share code, notes, and snippets.

@neonichu
Last active September 18, 2019 14:09
Show Gist options
  • Save neonichu/9487584 to your computer and use it in GitHub Desktop.
Save neonichu/9487584 to your computer and use it in GitHub Desktop.
Update DVTPlugInCompatibilityUUIDs for installed plugins from Xcode 5.1 beta to final
#!/bin/sh
#ID='A16FF353-8441-459E-A50C-B071F53F51B7' # Xcode 6.2
ID='992275C1-432A-4CF7-B659-D84ED6D42D3F' # Xcode 6.3
PLIST_BUDDY=/usr/libexec/PlistBuddy
function add_compatibility() {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
"$1/Contents/Info.plist"
}
function has_compatibility() {
$PLIST_BUDDY -c 'Print DVTPlugInCompatibilityUUIDs' \
"$1/Contents/Info.plist"|grep -q "$2"
return $?
}
cd "$HOME/Library/Application Support/Developer/Shared/Xcode/Plug-ins"
for file in `ls -d *`
do
if `has_compatibility "$file" $ID`
then
true
else
echo "Plugin $file is now compatible with the newest Xcode"
add_compatibility "$file" $ID
fi
done
@kostiakoval
Copy link

How do you find that version number in Xcode "C4A681B0-4A26-480E-93EC-1218098B9AA0" ?

@neonichu
Copy link
Author

/usr/libexec/PlistBuddy -c 'Print DVTPlugInCompatibilityUUID' "$(xcode-select -p)/../Info.plist"

@XUJiahua
Copy link

Thanks a lot. It really helps.

@winkelsdorf
Copy link

Nice!

Further automation, without the need to enter a Xcode ID manually:

#!/bin/sh

# get ID via PlistBuddy
PLIST_BUDDY=/usr/libexec/PlistBuddy
ID="$($PLIST_BUDDY -c 'Print DVTPlugInCompatibilityUUID' "$(xcode-select -p)/../Info.plist")"

function add_compatibility() {
  "$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
    "$1/Contents/Info.plist"
}

function has_compatibility() {
  $PLIST_BUDDY -c 'Print DVTPlugInCompatibilityUUIDs' \
    "$1/Contents/Info.plist"|grep -q "$2"
  return $?
}

cd "$HOME/Library/Application Support/Developer/Shared/Xcode/Plug-ins"

for file in `ls -d *`
do
  if `has_compatibility "$file" $ID` 
  then
    true
  else
    echo "Plugin $file is now compatible with the newest Xcode"
    add_compatibility "$file" $ID
  fi
done

@Sunitadaffodil
Copy link

Where to use this script in xcode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment