Completely disable the power button on my MacBook
I have a MacBook Pro Retina, Mid 2015 running macOS Sierra 10.12.2.
I want to completely stop my power button turning off, sleeping or restarting my device; I have already tried other solutions such as running this command:
defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool no
but all that does is change the behaviour to opening a window with a default action of shut down!
I just want to stop other people, or myself, from purposefully/accidentally using it to turn off my computer. It's a button I've never used, apart from when I first bought my MacBook sometime two years ago.
I still need the button to be able to turn on the device, obviously.
DanHollis solution is good, but it merely disables the button in software. I'll tell you how to completely disable the button.
You will need:
- Center hole punch. 1/8" recommended.
- A hammer, preferably light-weight so you have very fine control of your swing.
Step One
Align the CHP over the power button. The 'Center' in Center Hole Punch is instructive - you need to make sure you're exactly over the switch itself. Done correctly, this will remove the switch without affecting any other components in your MacBook.
Step Two
Swing the hammer. Sounds simple, but it's not. Make the swing fast and accurate, but don't put much force behind it. The point here is to strike quickly enough to punch out the switch itself, but not with enough force to penetrate deeper and actually damage something. Done right, the CHP will strike through and permanently disable the switch. Too fast or forceful and you'll break the computer. Too slow and you'll just turn the computer off.
Results
Your power button is now completely disabled. If the need arises, you can start the computer by manually shorting the contacts the switch connects to. On my desktop I can do this by arcing the pins with a knife, but the MacBook won't offer you the internal space to do that. I leave this as an exercise to the reader.
Suggestions
You might want to practice your hammer swings before doing this for real. I suggest practicing on a meaty part of your leg. The objective is to swing as fast as possible without feeling pain. If you swing too hard, it'll hurt. Too soft, and you'll just be tapping your leg. However, if the hammer bounces back and it doesn't hurt, you're doing it right. Just practice until you're confident and you'll do fine.
I currently am not in front of my mac but I found this command:
cd /System/Library/CoreServices/loginwindow.app/Contents/Resources/English.lproj
mv PowerButton.nib PowerButton1.nib
here in which you can save it as an app and auto start it at login here
You can also use a program like PowerKey to remap the power button, it will still shut down if you hold it as that is handled by the motherboard, not the OS (whether you're using regular macOS or Windows through Bootcamp)
There is no way of disabling the press and hold force shutdown as it is handled by the hardware and cannot be affected by the software... unless possibly flash an edited BIOS that disables it
If I need to improve this, please tell me how
I will be testing this for myself tomorrow