Skip to content

Instantly share code, notes, and snippets.

@NSExceptional
Last active December 14, 2016 05:42
Show Gist options
  • Save NSExceptional/2b0401299bc7cb1411bf0906368f9122 to your computer and use it in GitHub Desktop.
Save NSExceptional/2b0401299bc7cb1411bf0906368f9122 to your computer and use it in GitHub Desktop.
Bash function to unsign the Xcode binary to allow loading of third party plugins again.
# Assumes the `unsign` binary is in your PATH.
# https://github.com/steakknife/unsign
#
# (Download zip, run `make`, move the generated binary to /usr/bin)
# Remove Xcode code signature, backup stored as Xcode.signed
xcunsign() {
_xcode=/Applications/Xcode.app/Contents/MacOS/Xcode
# Is Xcode installed?
if [ ! -f $_xcode ]
then
echo "Could not find Xcode binary at "$_xcode
return
fi
# Is unsign installed?
if ! type unsign >/dev/null
then
echo "Is unsign in your PATH?"
return
fi
# Does Xcode.signed exist already?
if [ -f $_xcode.signed ]
then
echo "It appears you have already removed Xcode's code signature."
return
fi
sudo unsign $_xcode
sudo mv -f $_xcode $_xcode.signed
sudo mv -f $_xcode.unsigned $_xcode
echo "Unsigned Xcode"
echo "$_xcode -> $_xcode.signed"
echo "$_xcode.unsigned -> $_xcode"
echo
echo "You can undo this operation by running xcundounsign"
}
# Restores backup by renaming Xcode.signed to Xcode
xcundounsign() {
_xcode=/Applications/Xcode.app/Contents/MacOS/Xcode
# Does Xcode.signed exist already?
if [ ! -f $_xcode.signed ]
then
echo "Nothing to undo."
return
fi
sudo mv $_xcode.signed $_xcode
echo "$_xcode.signed -> $_xcode"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment