Wednesday 6th June, 2012
In Snow Leopard, Apple shrunk all their NIB files and as such partly took our toys away; while poking other people's NIBs and editing them arbitrarily has never been a terribly good plan, I've been rather used to poking around the insides of Apple's applications ever since I did horrendous things to a copy of System 7 with ResEdit and more caffeine than was good for me. So I slightly object to them taking this away.

These days, when you try to open the NIB files inside Apple applications in InterfaceBuilder it complains, saying that 'The document could not be opened. Interface Builder cannot open compiled nibs.' Fortunately, there is a workaround, and it exists below. The actual workaround itself, if you want to follow along with pretty screenshots, is at macstories.

Short version: each NIB is a bundle containing a keyedobjects.nib file and some extra metadata. Non-editable NIB bundles are missing this metadata.

The below (or the download) is a shell script which allows one to peer into the depths of compiled nib files. I don't entirely want to call it a NIB decompiler, because I don't know in detail what nibtool -compile actually does; but it can certainly make NIBs editable. Normal warnings apply: back anything up before poking it, don't muck around with things that are likely to get replaced or break things, if any of your apps break you get to keep both pieces.

#!/bin/sh
# nibsnoop.sh 0.1
test "$1" != "" || echo "usage: $0 nibfile" >&2
test "$1" != "" || exit

test -f "$1/keyedobjects.nib" || echo "This nib is not in the right format or does not exist.  Sorry." >&2
test -f "$1/keyedobjects.nib" || exit

cat <<CLASSES | openssl base64 -d -out "$1/classes.nib"
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBF
IHBsaXN0IFBVQkxJQyAiLS8vQXBwbGUvL0RURCBQTElTVCAxLjAvL0VOIiAiaHR0
cDovL3d3dy5hcHBsZS5jb20vRFREcy9Qcm9wZXJ0eUxpc3QtMS4wLmR0ZCI+Cjxw
bGlzdCB2ZXJzaW9uPSIxLjAiPgo8ZGljdD4KCTxrZXk+SUJDbGFzc2VzPC9rZXk+
Cgk8YXJyYXk+CgkJPGRpY3Q+CgkJCTxrZXk+Q0xBU1M8L2tleT4KCQkJPHN0cmlu
Zz5VS05pYk93bmVyPC9zdHJpbmc+CgkJCTxrZXk+TEFOR1VBR0U8L2tleT4KCQkJ
PHN0cmluZz5PYmpDP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goJPGtleT5JQlZlcnNpb248L2tleT4KCTxzdHJpbmc+MTwvc3Ry
aW5nPgo8L2RpY3Q+CjwvcGxpc3Q+Cg==
CLASSES

cat <<INFO | openssl base64 -d -out "$1/info.nib"
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBF
IHBsaXN0IFBVQkxJQyAiLS8vQXBwbGUvL0RURCBQTElTVCAxLjAvL0VOIiAiaHR0
cDovL3d3dy5hcHBsZS5jb20vRFREcy9Qcm9wZXJ0eUxpc3QtMS4wLmR0ZCI+Cjxw
bGlzdCB2ZXJzaW9uPSIxLjAiPgo8ZGljdD4KCTxrZXk+SUJGcmFtZXdvcmsgVmVy
c2lvbjwva2V5PgoJPHN0cmluZz42Nzc8L3N0cmluZz4KCTxrZXk+SUJMYXN0S25v
d25SZWxhdGl2ZVByb2plY3RQYXRoPC9rZXk+Cgk8c3RyaW5nPi4uL0h1bHUgRGVz
a3RvcC54Y29kZXByb2o8L3N0cmluZz4KCTxrZXk+SUJPbGRlc3RPUzwva2V5PgoJ
PGludGVnZXI+NTwvaW50ZWdlcj4KCTxrZXk+SUJPcGVuT2JqZWN0czwva2V5PgoJ
PGFycmF5PgoJCTxpbnRlZ2VyPjY8L2ludGVnZXI+Cgk8L2FycmF5PgoJPGtleT5J
QlN5c3RlbSBWZXJzaW9uPC9rZXk+Cgk8c3RyaW5nPjlHNTU8L3N0cmluZz4KCTxr
ZXk+dGFyZ2V0RnJhbWV3b3JrPC9rZXk+Cgk8c3RyaW5nPklCQ29jb2FGcmFtZXdv
cms8L3N0cmluZz4KPC9kaWN0Pgo8L3BsaXN0Pgo=
INFO

posted by Rob Mitchelmore, 15:54 (anchor)
June 2015May 2015April 2015June 2014
January 2014November 2013October 2013July 2013
April 2013March 2013January 2013November 2012
older posts