My Hammerspoon config for Mac nerds.
Use this config with smc_fan_util, AnVMSR amd smcutil. (Maybe I will write a combined binary later)
Also, to ensure that the commands that require root privileges function properly, do any of the following:
Include your user name and password in all the hs.osascript.applescript
sections.
For example:
change
hs.osascript.applescript(string.format('do shell script "%s"', cmd))
to
hs.osascript.applescript(string.format('do shell script "%s" password "yourpassword" with administrator privileges, cmd))
Disable password prompts for sudo
command.
Edit /private/etc/sudoers
using this command: sudo vim /private/etc/sudoers
Find something like root ALL = (ALL) NOPASSWD: NOPASSWD: ALL
and change the surrounding 3 lines to:
# root and users in group wheel can run anything on any machine as any user
root ALL = (ALL) NOPASSWD: NOPASSWD: ALL
%admin ALL = (ALL) NOPASSWD: NOPASSWD: ALL