Search code examples
iosxcode4

show ANSI color in Xcode4 debug console


Is there any way to do this? I wan't to distinguish my Logs by different colors.


Solution

  • To enable ANSI colors in Xcode console install clone https://github.com/robbiehanson/XcodeColors and build. The build process will install the Xcode plugin in the proper directory.

    To unsign Xcode clone https://github.com/steakknife/unsign, run make, put the unsign command in the path. Then run the following:

    cd /Applications/Xcode.app/Contents/MacOS
    sudo unsign Xcode
    sudo mv Xcode Xcode.signed
    sudo ln -sf Xcode.unsigned Xcode
    

    Note that this is reversible. Just change the symbolic link. Now you need to update the plugin UUID to match the current Xcode version:

    XCODEUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
    
    for f in ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/*; do defaults write "$f/Contents/Info" DVTPlugInCompatibilityUUIDs -array-add $XCODEUUID; done
    

    Now you can use ANSI colors in your Xcode console. It looks like this: