Loads safely thunderbolt drivers on 2014 MBP retina with the random shutdown issue
I have a tweaked solution, for who like me needs the thunderbolt ports.
So, moving the AppleThunderboltNHI.kext driver means that every tunderbold device will not be recognised if hot plugged so not only the thunderbolt lan adapter but also hard drives and other things.
If you reboot they will be recognised as PCI devices, but this still results in random shutdowns for me, so it's important to disconnect any tunderbolt device before turning on the machine, also because PCI drivers do not support hot plug, so you can get a kernel panic if you remove e device this way.
So, enter the "hybrid" solution:
First, neutralise the driver by moving it to a different folder without renaming it
if you haven't disabled SIP already
-
reboot with CMD+R pressed
-
open Terminal
-
sudo csrutil disable
-
reboot
-
open terminal
-
sudo mkdir /System/Library/Extensions_dis (create a directory to store "disabled" drivers)
-
sudo mv /System/Library/Extensions/AppleThunderboltNHI.kext /System/Library/Extensions_dis/AppleThunderboltNHI.kext
if you want to re-enable SIP 8) reboot with CMD+R pressed 9) csrutil enable 10) reboot
Now you can create an executable to run every time you need to use the a thunderbolt device, this script will load the driver and launch the famous python script to prevent the Mac from crashing.
The python script is using a considerable amount of power so wen the thunderbolt device are not needed its better not to have it running for better battery life and performances.
- Open automator and create a new "Application" document
- from the side bar select "Run Shell Script", under Utilities
- select the kind of shell as “/usr/bin/python“
- paste this code:
from time import sleep import os
os.system ("killall ScriptMonitor") #this avoids having the automator monitor open after running the application
os.system (" echo yourPassword | sudo -S kextload /System/Library/Extensions_dis/AppleThunderboltNHI.kext ") #this loads the driver
#this keeps your mac alive, you can tweak the number, the original one is (0.00002) and corresponds to a quite hight 20% cpu load, (0.001) is around 2% and its seems to be enough on my system
while True: sleep(0.001)
-
replace yourPassword with your system password, it is needed to load the kext
-
export the application, if you prefer you can download it form here https://github.com/pignoniG/Load_Tunderbolt but you need to edit the "Contents/document.wflow" file inside the app and replace "yourPassword" with your password.