Skip to content

Instantly share code, notes, and snippets.

@blahgeek
Created March 10, 2016 02:12
Show Gist options
  • Save blahgeek/774599fc810dea3bf6ac to your computer and use it in GitHub Desktop.
Save blahgeek/774599fc810dea3bf6ac to your computer and use it in GitHub Desktop.
Stop Safari hanging when selecting the address bar or opening a new tab
This shit has been bugging me for too long, so I went on a hunt and found a workaround.
The Symptoms are as follows:
* Clicking the address bar results in a 1-4 second delay
* Opening links in new tabs results in a 1-4 second delay
* +T results in a 1-4 second delay
* `PressAndHold[<pid>]: IMKServer Stall detected` is present in `/var/log/system.log` at the time of the hang.
It appears to be to do with the PressAndHold helper - the thing that shows an IOS style selection of accents when you hold a key down.
The fix may have some unwanted effects, I haven't really noticed any.
1. Reboot into system restore mode (+R immediately after boot)
2. Navigate to Utilities > Terminal
3. Enter the command `crsutil disable`
4. Reboot
5. Open Terminal
6. `defaults write -g ApplePressAndHoldEnabled -bool false && launchctl remove $(launchctl list | grep -oE 'com.apple.PressAndHold.+$')`
7. `sudo chmod 000 /System/Library/Input\ Methods/PressAndHold.app/Contents/MacOS/PressAndHold`
8. Reboot
You can choose reboot back into restore mode and issue `crsutil enable` again to re-enable rootless mode.
However, if you're constantly hacking around with bits of the OS like me, then you can leave it disabled.
Hope this helps..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment