Adding Bytes Using a Hex Editor
You don't need additional software for this, the standard vi
installed by macOS can edit binary files.
cd /Applications/Microsoft\ Word.app/Contents/MacOS/
cp Microsoft\ Word Microsoft\ Word.orig
vi -b Microsoft\ Word
Now, assuming you are not used to vi
:
- Type
/app-sandbox
followed by Return to jump to the definition you want to change
- Press Return again to move the cursor to the next line
- Type
ct/<false
followed by ESC
- Type
ZZ
to save and quit
PS: If you get stuck within vi
, press ESC twice and then type :q!
to quit without saving.
If you want to script this, use (at our own risk)
vi -b Microsoft\ Word '+/app-sandbox/+1s/true/false/' '+wq'
which basically does the same thing as the interactive sequence above in one go.
-
/app-sandbox/+1
makes the following command (the substitution) only apply on the line after the one containing theapp-sandbox
string -
s/true/false/
is the substitution and replacestrue
byfalse
-
wq
writes the modified file back to disk and quits