https://github.com/miquels/macbook-fix-touchbar
Workaround for macbooks rebooting because the touchbar got hung
https://github.com/miquels/macbook-fix-touchbar
controlstrip crash fix macos touchbar
Last synced: 4 months ago
JSON representation
Workaround for macbooks rebooting because the touchbar got hung
- Host: GitHub
- URL: https://github.com/miquels/macbook-fix-touchbar
- Owner: miquels
- License: mit
- Created: 2024-02-06T18:48:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-07T18:58:04.000Z (over 2 years ago)
- Last Synced: 2024-11-22T01:55:32.513Z (over 1 year ago)
- Topics: controlstrip, crash, fix, macos, touchbar
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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!