Giter Site home page Giter Site logo

macbook-fix-touchbar's Introduction

macbook-fix-touchbar

Workaround for macbooks rebooting because the touchbar got hung.

On macbooks with a touch bar, sometimes the hardware of the touchbar will get confused and fail to respond. Usually you'll also see the touch bar flashing, or going completely black.

After 180 seconds the macos watchdogd will then conclude that there is a fatal hardware problem, and crash/reboot the system.

There are 2 curious facts about this problem:

  • it doesn't happen while you're typing / using the touchpad
  • killing the TouchBarServer resets the hardware and the watchdog

So the fix-touchbar script runs in the background, and every few seconds it checks:

  • are we idle more than 60 seconds (not typing etc)
  • in that case, restart the TouchBarServer process once a minute. (note that we also restart the ControlStrip process for good measure)

This seems to work. Most of the time, at least.

Install:

For a script that runs as a normal user to be able to kill the (root) TouchBarServer process, you need to add a line to the end of the User Specification part of the /etc/sudoers file. You can do this by running visudo as root and adding this:

ALL             ALL=(root) NOPASSWD: /usr/bin/pkill -x TouchBarServer

Note that this will enable any user on the macbook to issue the command sudo pkill -x TouchBarServer - which should not really be a problem.

Then, run these commands (as yourself, not as root) to install the script to run as a daemon:

cp fix-touchbar ~/Library/Scripts
chmod 755 ~/Library/Scripts/fix-touchbar
cp nl.z42.FixTouchBar.plist ~/Library/LaunchAgents/
chmod 644 ~/Library/LaunchAgents/nl.z42.FixTouchBar.plist
launchctl enable gui/$UID/nl.z42.FixTouchBar
launchctl start nl.z42.FixTouchBar

Uninstall:

Run these commands as a normal user:

launchctl stop nl.z42.FixTouchBar
launchctl disable gui/$UID/nl.z42.FixTouchBar
rm ~/Library/Scripts/fix-touchbar ~/Library/LaunchAgents/nl.z42.FixTouchBar.plist

Then run visudo as root to remove the pkill line from the sudoers file.

Good luck!

macbook-fix-touchbar's People

Contributors

miquels avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.