-
-
Save JanX2/07788c3654a4984088926065ed4aaa26 to your computer and use it in GitHub Desktop.
Create a complete class-dump of Xcode, ready for adding to an empty Xcode project for all your header-ogling needs.
This file contains 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
#!/bin/bash | |
# Creates a complete class-dump of Xcode and all its libs and internal plug-ins. | |
# Assumes you have Class-Dump in your path and Xcode at the location set via `xcode-select`. | |
xcodeClassDump=${1:-"$HOME/Documents/XcodeClassDump"} | |
xcodePath=`xcode-select -p` | |
sourceXcodeRootPath="$(dirname "$xcodePath")" | |
echo "Dumping from Xcode: $sourceXcodeRootPath" | |
echo "Creating dump in $xcodeClassDump" | |
# We need to `cd` into the directory, because we remove paths containing ".app" below and this would otherwise filter out everything contained in "Xcode.app". | |
cd "$sourceXcodeRootPath" | |
# Find all libraries and plug-ins within Xcode.app/Contents and call class-dump | |
# on each, preserving the folder structure in the output files. | |
# This will give many warnings like "doesn't contain an executable" or | |
# "Parsing method types failed". But it will succeed much more than it fails. | |
find . \( -iname "*.framework" -or -iname *.ideplugin \) ! -ipath *.platform* ! -ipath *.app* -print0 | xargs -0 -o -I % class-dump --arch x86_64 --sdk-mac -I -H -o "$xcodeClassDump/%" % | |
# Strip .framework and .ideplugin extensions from output folder names, so the | |
# files can be browsed more easily. | |
# (for example by adding the whole output folder to an empty Xcode project) | |
find "$xcodeClassDump" \( -iname "*.framework" -or -iname *.ideplugin \) -print | while read filename; do mv -v "$filename" "${filename%.*}"; done |
Merged your fork. Thank you for the improvements!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This looks like a nice update to my crude script. It's still not possible to open a pull request on a gist, right? I'll merge your changes into my gist this weekend.