Last active
December 14, 2016 05:42
-
-
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.
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
# 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