devl.cz/ macos-tips

macOS tips

PC-style Home and End

I never got used to Home/End keys that only scroll to start/end of document. That is a feature I use very little, while in text boxes and on command line I need to jump to start/end of line a lot. So I always rebind the keys system-wide.

The standard combinations on macOS are these:

To remap the keys, create this file in user home:

~/Library/KeyBindings/DefaultKeyBinding.dict

Note that the KeyBindings directory may not exist yet.

Put this content in the file:

{
    "\UF729"  = moveToBeginningOfLine:; // home
    "\UF72B"  = moveToEndOfLine:; // end
    "$\UF729" = moveToBeginningOfLineAndModifySelection:; // shift-home
    "$\UF72B" = moveToEndOfLineAndModifySelection:; // shift-end
}

Other keys may be remapped in the same way. See all standard bindings:

plutil -p /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict

References:

Touch ID sudo

Add to beginning of /etc/pam.d/sudo:

auth       sufficient     pam_tid.so

External display: force RGB mode

When connecting external monitor via HDMI, macOS may choose “TV” mode (YPbPr/YCbCr) instead of native RGB mode. This may lead to awful artifacts - distorted colors or pixels. In my case, with monitor HP LP2475w, it looked as if the picture was downscaled and upscaled back again. Some pixels were in wrong place.

There is no user setting for display mode. It can be fixed only in Recovery, by adding a file to the protected system partition. Unfortunately, this may not survive OS upgrades.

Steps:

References:

List non-standard KEXTs

These have the strongest privileges, so it’s good to know about them:

kextstat --list | grep -vF 'com.apple.'