A patch collection to save your Xcode

Overview

Xcode Patch

Xcode is worst IDE I have ever used

Xcode 13.3 introduced a very annoying bug. When you type anything with Chinese IME in the LLDB console, the whole app freezes! I did some investigation and fixed this issue before Apple publishes the next release.

Screenshot

If you can't stand this issue either, this patch is gonna help you. But I highly recommend you to wait for the next release, because this approach will require you to re-sign your Xcode!

Instructions

1. Re-sign Xcode

There are many ways to re-sign Xcode. For example, I'm using a little Python script and it works pretty well. You can simply pick a method that you have been validated.

2. Validate Re-sign

Launch Xcode and try attaching it via LLDB. If it succeeded, everything is ok and keep going. Otherwise, you are not lucky today.

3. Compile the Patch

Open XcodePatch.xcodeproj and click the build button. Grab the produced libXcodePatch.dylib file and copy it to /usr/local/lib.

4. Inject the Patch

Now you need to make Xcode load the patch library. Here I will use Python with LIEF library.

If you haven't installed LIEF:

pip3 install lief

then execute the following script:

import lief

xcode = lief.parse("/path/to/Xcode.app/Contents/MacOS/Xcode")

patch_lib = lief.MachO.DylibCommand.weak_lib('/usr/local/lib/libXcodePatch.dylib')
xcode.add(patch_lib)

xcode.write("/path/to/Xcode.app/Contents/MacOS/Xcode")

5. Re-sign Xcode Again

Since you just modified the executable file of Xcode, you need to re-sign the bundle again. Don't worry, you had validated the possibility of self-signing Xcode earlier, just repeat the first step.

Future Directions

  • Make this repository a universal patch collection for Xcode.
  • A easy-to-use re-signing tool.

Known Issues

  • Re-signing Xcode will make Apple Developer accounts integration unable to work (as well as "Automatically manage signing").

Disclaimer

During your operations, Xcode can be broken and cannot be opened anymore. This is irrelevant to this repository. Please don't install this patch when you are urgent about doing your serious work or something.

This patch contains nothing malicious, read the code if you still have concern.

You might also like...
A fancy collection style view controller that was inspired by this Profile Card mockup
A fancy collection style view controller that was inspired by this Profile Card mockup

JFCardSelectionViewController A fancy collection style view controller that was inspired by this Profile Card mockup: https://dribbble.com/shots/14584

A collection of common SwiftUI and UIKit utilities.

KippleUI A collection of common SwiftUI and UIKit utilities. ⚠️ The code in this library has been made public as-is for the purposes of education, dis

A collection of common diagnostics and debugging utilities.

KippleDiagnostics A collection of common diagnostics and debugging utilities. ⚠️ The code in this library has been made public as-is for the purposes

🧸 Xcode Playground management made easy
🧸 Xcode Playground management made easy

Toybox Toybox made easy to manage Xcode Playgrounds. You can create and open Xcode Playground from CLI. $ toybox create Snippet # Generate ~/.toybox/S

🚀 Create, maintain, and interact with Xcode projects at scale
🚀 Create, maintain, and interact with Xcode projects at scale

What's Tuist 🕺 Tuist is a command line tool that helps you generate, maintain and interact with Xcode projects. It's open source and written in Swift

SwiftLint Plugin for Xcode.
SwiftLint Plugin for Xcode.

SwiftLint Xcode Plugin Demo Usage Set SwiftLint Path default: Default path is /usr/local/bin/swiftlint relative: Relative path with the current projec

XCode Preview template for UIkit based project.
XCode Preview template for UIkit based project.

SwiftPreview XCode Preview template for UIkit based project. Support custom file template class inherit from UIView and UIViewController. How to use?

Play with Xcode storyboards...

Storyboards In this repo, we will be playing with storyboards. Add Table View and Collection Views and show some data using the data source and delega

The Xcode playground labs from the Develop in Swift Fundamentals and Data Collections books.
The Xcode playground labs from the Develop in Swift Fundamentals and Data Collections books.

Develop in Swift Labs A repository with the student materials from the Xcode 12 version of Develop with Swift Fundamentals This repo contains the Swif

Comments
  • Build error for iOS target

    Build error for iOS target

    I run all step. can run Xcode. but not build iOS target

    error: failed to read asset tags: The command `(cd /Users/hanson/Desktop/aaaabb && /Applications/Xcode.app/Contents/Developer/usr/bin/actool --print-asset-tag-combinations --output-format xml1 /Users/hanson/Desktop/aaaabb/aaaabb/Assets.xcassets)` terminated with uncaught signal 6. The command's standard error was:
    
    dyld[8493]: Library not loaded: @rpath/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation
      Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/ibtoold
      Reason: tried: '/Applications/Xcode.app/Contents/Developer/usr/bin/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (no such file), '/Applications/Xcode.app/Contents/Developer/usr/bin/../../../Frameworks/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (code signature in <4E25B0D6-C059-3B91-8642-F965732139D4> '/Applications/Xcode.app/Contents/Frameworks/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/Xcode.app/Contents/Developer/usr/bin/../../../SharedFrameworks/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (no such file), '/Applications/Xcode.app/Contents/Developer/usr/bin/../../../PlugIns/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (no such file), '/Applications/Xcode.app/Contents/Developer/usr/bin/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (no such file), '/Applications/Xcode.app/Contents/Developer/usr/bin/../../../Frameworks/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (code signature in <4E25B0D6-C059-3B91-8642-F965732139D4> '/Applications/Xcode.app/Contents/Frameworks/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/Xcode.app/Contents/Developer/usr/bin/../../../SharedFrameworks/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (no such file), '/Applications/Xcode.app/Contents/Developer/usr/bin/../../../PlugIns/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (no such file), '/Library/Frameworks/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (no such file), '/System/Library/Frameworks/AssetCatalogFoundation.framework/Versions/A/AssetCatalogFoundation' (no such file)
     (in target 'aaaabb' from project 'aaaabb')
    
    test
    opened by Hansoncoder 4
  • Fail to write binary file

    Fail to write binary file

    In Step4, when I use python to execute the script. I got the result of 'Fail to write binary file'.

    Lief already installed,and the path is correct.

    How can I make it success?

    (MacBook Pro (13-inch, M1, 2020) , xcode = xcode_fat.take(lief.MachO.CPU_TYPES.ARM64) )

    opened by a724632952 3
Owner
Cyandev
An initiate of programming.
Cyandev
Save development time! Respresso automatically transforms and delivers your digital assets into your projects

Respresso Android client Respresso is a centralized resource manager for shared Android, iOS and Web frontend projects. It allows you to simply import

Respresso 11 May 27, 2021
Save development time! Respresso automatically transforms and delivers your digital assets into your projects

Respresso iOS client Respresso is a centralized resource manager for shared Android, iOS and Web frontend projects. It allows you to simply import the

Respresso 50 May 1, 2021
LinkedLog is a Xcode plugin that includes a Xcode PCH header file template that adds the macros `LLog` and `LLogF` and parses their output to link from the console to the corresponding file and line.

LinkedLog Xcode Plugin LinkedLog is a Xcode plugin that includes a Xcode PCH file template that adds the macros LLog and LLogF. The LLog macro will wo

Julian F. Weinert 22 Nov 14, 2022
A Swift command line tool for generating your Xcode project

XcodeGen XcodeGen is a command line tool written in Swift that generates your Xcode project using your folder structure and a project spec. The projec

Yonas Kolb 5.9k Jan 9, 2023
📝 Read, update and write your Xcode projects

XcodeProj XcodeProj is a library written in Swift for parsing and working with Xcode projects. It's heavily inspired by CocoaPods XcodeProj and xcode.

Tuist 1.7k Dec 28, 2022
The awesome Fastlane tools brought into your Xcode

Fastlane-Plugin for Xcode Features Run fastlane command with one click. Add your Fastfile in xcode. Setup Fastlane. Install Install via Alcatraz OR Cl

Rishabh Tayal 38 Jun 6, 2021
Xcode Plugin helps you find missing methods in your class header, protocols, and super class, also makes fast inserting.

FastStub-Xcode Life is short, why waste it on meaningless typing? What is it? A code generating feature borrowed from Android Studio. FastStub automat

mrpeak 509 Jun 29, 2022
A Collection of PropertyWrappers to make custom Serialization of Swift Codable Types easy

CodableWrappers Simplified Serialization with Property Wrappers Move your Codable and (En/De)coder customization to annotations! struct YourType: Coda

null 393 Jan 5, 2023
A collection of Swift Tutorials built with Apple's DocC.

Swift Tutorials This is not a package, it's just a bunch of tutorials This project uses Apple's DocC (Documentation Compiler) to create a set of Swift

Swift Innovators Network 11 Aug 9, 2022
A collection of native SwiftUI layouts (iOS 16+)

SwiftUILayouts A library of commonly requested layouts. Implemented using SwiftUI's native layout system. NOTE: SwiftUILayouts requires iOS 16 or abov

Apptek Studios 25 Dec 26, 2022