Ignore Clamshell state changes - keep display on

Hi users.


I just got a 2012 Retina Macbook Pro given to me which was a god-send because my early-2008 MBP really wasn't cutting it anymore.

Some liquid was spilled on it, causing the hall effect sensor (lid sensor) to think the lid is frequently (1-2 times per minute on average) being closed and opened again couple of seconds later. Otherwise the machine works just fine.


So I'm trying to find a way to make the OS ignore input from the sensor and/or bypass it in some way. I've confirmed the issue using "ioreg -r -k AppleClamshellState", it's "No" when screen is on and "Yes" when it turns dark. So I'm trying to find a way to have it constantly be set to "No". That command also outputs "AppleClamShellCausesSleep" which is set to "Yes", changing that to "No" might also be an option, IF I can find a way to do it.

Ioreg tells me these variables are in the IOPMrootDomain class, I've found the source code for it on Apple's Open Source website but that doesn't really help me at this time because even if I would change it and compile a new version, I don't know how to implement it.

Another option would be if there is some CLI tool like "pmset" that would allow me to set a variable that would solve this issue and have that run at startup using a script.


I'm running 10.12.6 for now because it's missing the SSD and I'm running the OS from a USB stick until I can solve this issue and confirm the machine is usable. I need to update the EFI firmware on the machine to make it usable on APFS, therefore no 10.13-14.