Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to know how to edit the binary file in a Mac app. The file I am attempting to edit is found in foo.app/Contents/MacOS/foo...

Whenever I try editing it with TextMate, it saves fine. But then I try opening the app, it won't open or it crashes. I suspect this is the OS detecting a change in the app and disallowing execution afterwards? I'm editing simple stuff which would not affect successfully opening the app, such as a URL. Why is this happening and how can I fix it?

share|improve this question
add comment

1 Answer 1

You really shouldn't be editing a binary executable with TextMate. If you must edit it, use a proper text editor like Hex Fiend (http://ridiculousfish.com/hexfiend/). Also, for simplicity you should make sure that whatever URL you are replacing you replace it with one of equal length. Binary files have physical offsets that are used when reading them into memory, and insertion and deletions can corrupt the binary.

If you need to replace a URL it should be easy enough to pad the URL with a / for example http://google.com/////.

share|improve this answer
    
I tried it with Hex Fiend too. Doesn't work. –  this_is_a_no_wombat_zone Feb 7 '12 at 5:34
1  
Are you sure the length of the URL is the same? Patching binaries is an advanced task. You need to know a great deal about the Mach-O format specification to do it reliably. You sound out of your depth. –  solo Feb 7 '12 at 5:39
    
I'm new to editing binaries. Haha –  this_is_a_no_wombat_zone Feb 7 '12 at 5:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.