In this example, we'll be patching /Library/Extensions/NVDAStartupWeb.kext/Contents/Info.plist
, replacing any occurrences of <string>17B1003</string>
with <string>17C88</string>
, allowing us to enable the Nvidia Web Driver on "unsupported" versions of macOS, such as newly released updates, without having to wait for an updated driver to become available.
It's very important to note that there are actually two spaces in the replacement value (Markdown doesn't display them correctly), as the character lengths of both values must always match. In this case it made more sense to add the spaces before rather than after, as they're most likely to already exist in the original Info.plist
.
This shows how you can encode both values to a base64 encoded string, which is the format that'll end up in the patch itself.
echo -n '<string>17B1003</string>' | python -m base64
# Output: PHN0cmluZz4xN0IxMDAzPC9zdHJpbmc+
echo -n ' <string>17C88</string>' | python -m base64
# Output: ICA8c3RyaW5nPjE3Qzg4PC9zdHJpbmc+
This shows how you can decode the values from a base64 encoded string, back to an unencoded string. This is useful if you wish to double check that the encoding succeeded, as otherwise the patch will not work.
echo -n 'ICA8c3RyaW5nPjE3Qzg4PC9zdHJpbmc+' | python -m base64 -d
# Output: <string>17C88</string>
echo -n 'PHN0cmluZz4xN0IxMDAzPC9zdHJpbmc+' | python -m base64 -d
# Output: <string>17B1003</string>
This is an example of what the patch would end up looking when added to your config.plist
. This should be fairly self-explanatory.
<dict>
<key>Name</key>
<string>NVDAStartupWeb</string>
<key>Comment</key>
<string>Nvidia 17B1003 to 17C88</string>
<key>MatchOS</key>
<string>10.13.2</string>
<key>InfoPlistPatch</key>
<true/>
<key>Disabled</key>
<false/>
<key>Find</key>
<data>PHN0cmluZz4xN0IxMDAzPC9zdHJpbmc+</data>
<key>Replace</key>
<data>ICA8c3RyaW5nPjE3Qzg4PC9zdHJpbmc+</data>
</dict>