Fix MBP High Kernel_Task CPU in Sierra

Just encounter strange high cpu problem of kernel_task in Sierra on my rMBP. At first, it seems like some software problem, especially when opening atom editor, which causes long opening time. After closing atom, it does lower the cpu for a period, but running other task heavy software afterwards will also boost the kernel_task cpu percentage to 80%. It may suggest some underlying hardware problem there.

Comments in this post give the reason: temperature and fan control. Since it’s summer and super hot, the osx on my mbp is reducing cpu speed for temperature compensation, causing kernel task to take more cpu to consume. Resetting SMC in this article brings the fan control back and fixes the kernel_task cpu problem.

Fix 10.11.4 mysterious trackpad reset problem after reboot

Just encountered a mysterious problem after upgraded to 10.11.4 that every time MBP reboots and logins, my trackpad settings like tap-to-click are lost. It’s mysterious because during the very beginning time after login it worked as normal, but a few minutes later trackpad settings were reset automatically. It also affected the Mac AirPlay to AppleTV which would not work except for the first few minutes after reboot.

Googling the airplay problem leads to login items. But removing all of my existing login items doesn’t fix the problem. (Of course, the trackpad plist is the first try which also doesn’t work.)

And the console log during possible resetting trackpad has messages like “kernel[0]: Sandbox: CommCenter(3359) deny(1) file-read-metadata /Library/Developer” and “otherbsd[4246]: Could not submit LoginItem job com.XXX.XXXYYY: 119: Service is disabled”;

More googling doesn’t find much useful info. Similar keyboard reset problem exists but has no fix yet. When analyzing the details of the console logs, one interesting thing is that there’re two login window app started msg around that time, when the failed login items are all at the second login window session and possibly kill my trackpad settings and airplay.

Then why on earth exists another login window session? The culprit is _xcsbuildd. As 10.11.4 upgraded Mac Server, with XCode server service included, which will run as user _xcsbuildd at background. The upgraded service’s second login session breaks some login items which seems indeed killing airplay and resetting the trackpad settings.

Simply disable xcode service in Server.app will not remove _xcsbuildd related stuffs. Use this methods to totally get rid of it.

Finally reboot and enjoy the hassle-free trackpad and airplay again.

Fix 10.11 key chain prompt with deny only

Just encounter a strange problem of key chain access. When prompting for access to credentials, the dialog can only be dismissed by Deny. In the console, “Ignoring user action since the dialog has received events from an untrusted source” was logged.

According to this post, 10.11.1 contains a security patch to prevent synthetic clicks on keychain dialogs. Try disabling all apps in the privacy settings of accessibility-mac-control, but not works.

Therefore manually quitting such apps one by one will be the trick to check for the culprit. It founds that BetterTouchTool is the problem.

Update: 10.11.5 will correctly prompt for administrator password and shows the blocking app.

Fix safari or chrome scroll lagging in Yosemite

Just found some lagging when scrolling content in Chrome/Safari, especially after a few scrolls, the web page will pause about 0.5s then leap to the target position, which is quite annoying. After a few google around and testing, the Better Touch Tool v0.9995 is found to be the culprit. After disable it, all browsing returns smooth.

But as I use customized three finger swipes frequently, the magicprefs is now the alternative choice for gesture customization, which seems no conflict problem. But the system three finger swipe gesture must be disabled first in the trackpad preference pane, then the magic preference will enable the available gestures.

Update:

Just encounter a Yosemite system-wide problem of missing right click menu, but ctrl+click still works, which might be related to WindowServer process. Only reboot can get the right click back. After rebooting more than 10 times,  it seems to happen after drag & drop to secondary monitor by bluetooth mouse. Quite strange, not sure if it’s bluetooth problem or drag&drop problem. Revert to Better Touch Tool temporally. And BTT released 1.0 which seems no lagging problem now.

add route and dns for VPN connection in Mac

VPN now becomes a ubiquitous way for climbing over GFW in China. However, once the Mac is connected with VPN and sends traffic thru it , VPN’s dns and route setting will take priority over the default network settings, which sometimes is quite inconvenient for fast accessing local sites and using other dedicated network like ipv6.

There’s a combination of configurations to work around the dns and route table of VPN:

1) when connected to the VPN, in Terminal, use the way described to find which VPN’s dns you want modify

2) in Terminal, sudo vi /etc/ppp/scutil_vpn.txt, add following lines, replace the GUID with your target GUID:

d.init
get State:/Network/Service/E6592FF4-8A4F-4C86-B1A2-F865D658D4FF/DNS
d.add ServerAddresses *
set State:/Network/Service/E6592FF4-8A4F-4C86-B1A2-F865D658D4FF/DNS

4) in Terminal, sudo vi /etc/ppp/ip-up,(make it executable), add following lines, and modify the TARGET_IPADDR and MASK of which network subnet you want to go thru the VPN:

#!/bin/sh
/sbin/route add TARGET_IPADDR/MASK $5
/usr/sbin/scutil < /etc/ppp/scutil_vpn.txt

5) install and use dnsmasq to direct wildcard dns resolving for target server names to the VPN dns server

6) in the VPN settings, uncheck “Send All Traffic” box

7) done.

Now when you are connected with the target VPN, you will only go through the VPN to visit target domain names and ip you’ve set, with all other network like ipv6 unchanged. Of course,  the settings could be reversed to send most traffic thru VPN, leaving a few sites accessing locally.

Lion Upgrade Issues

  1. Missing ~/Library folder in Finder: Use “chflags nohidden ~/Library” in terminal to show it back
  2. QSB huge memory alloc bug for more than 4 words input: NO FIX yet, disable spotlight plugin to work around
  3. XCode 4.1 launch crash: install standalone iTunes 10.4 after install XCode 4.1
  4. 3 finger swipe crash chrome/terminal/…: remove AirKeysInputManager.bundle from simbl, upgrade betterTouchTool to support customizable Lion multi-touches
  5. No Trim support for 3rd party ssd: Use Trim Enabler 1.2 to re-enable Trim support for SSD in Lion
  6. Alt+up/down doesn’t work any more to switch Spaces, now Mission Control only have left/right horizontal Desktops, which is ridiculous and lousy for switch more than 2 desktops; Workaround: arrange common applications to Desktop 2 so that only one left/right switch is needed for most used 3 desktops, alt+number to direct jump
  7. Time Machine backup with link station is BROKEN because Lion use new netatalk 2.2 and new security protocol. No quick fix seems to come from Buffalo 🙁 A firmware 1.53beta upgrade is provided by Buffalo to fix TimeMachine backup issue, but it’s only for LS-CHL-V2, the CHL revision 1 seems no quick fix before September! Wait Again!
  8. Preview constantly crashes upon launching if some folder in home folder is a symbolic link to external hard disk folder; remove the symbolic link, relaunch preview(won’t crash now), and relink the symbolic link, preview will work since then.
  9. Autojump broken in Terminal: Fix by replacing line 47 in autojump.bash with

    export PROMPT_COMMAND=”$AUTOJUMP ; ${PROMPT_COMMAND:-:}”

  10. TextEdit also keeps crash upon launching: Same issue with Preview, remake downloads symlink will fix it.
  11. Full screen apps doesn’t support second display. Only the primary display could show the apps in full screen mode leaving other displaying only blank linen. And because the system menu bar is also on primary display, some functions are also hard to use for app maximized window on second display. Workaround: use this hack for opening another app in full screen as well as REMEMBER the keyboard shortcuts!
  12. VMWare Fusion 4 introduce its bluetooth and broke previously self-customized bluetooth broadcom driver, now only usable in client windows system booted when bluetooth is turned on OR check share bluetooth device with windows, otherwise,  even though device manager has one bluetooth device listed, the broadcom bluetooth software won’t recognize it either.