Google Chrome crashes hard with Mac OS 10.10.2 beta, here’s the fix

…Use Safari! (lol,)

Google Chrome 39 had started to crash for me as soon as I updated to 10.10.2 Beta. I tried all of the normal things (trashing Google prefs, using Canary, etc etc). Nothing worked except downgrading back to Mac OS 10.10.1 stable.

[tweet https://twitter.com/llsethj/status/538403705201377281]

It turns out that the new 10.10.2 has depreciated some Trackpad APIs that cause an immediate crash.

The answer comes via Reddit today:

Obviously use at your own risk: an Automator app has also been built to speed up the below process.

Workaround that was found on the Apple dev forums – this is not my code – use at your own risk – I’ve used it and it works fine.

1) Open up text edit and paste this code – save it as “patch.m”

#import <AppKit/AppKit.h>

__attribute((constructor)) void Patch_10_10_2_entry()
{
NSLog(@"10.10.2 patch loaded");
}

@interface NSTouch ()
- (id)_initWithPreviousTouch:(NSTouch *)touch newPhase:(NSTouchPhase)phase position:(CGPoint)position     isResting:(BOOL)isResting force:(double)force;
@end

@implementation NSTouch (Patch_10_10_2)
- (id)_initWithPreviousTouch:(NSTouch *)touch newPhase:(NSTouchPhase)phase position:(CGPoint)position     isResting:(BOOL)isResting
{
return [self _initWithPreviousTouch:touch newPhase:phase position:position isResting:isResting force:0];
}
@end

2) Run this command in Terminal

clang -dynamiclib -framework AppKit ~/Desktop/patch.m -o ~/Desktop/patch.dylib

3) Run this command in Terminal to open Chrome.

env DYLD_INSERT_LIBRARIES=~/Desktop/patch.dylib "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

Notes: This will leave Terminal open in the background, do not close it or Chrome will quit out. This doesn’t modify anything permanently just fixes it temporarily. To reopen chrome a second time all you have to do is repeat step 3.