2

I'd like to run some code, go away and have a coffee and come back to a MacBook with the NVRAM, PRAM and SMC all reset (rather than doing them manually with yoga postures to press all the keys, waiting around for various signals that it worked etc).

Is there a quick and easy terminal script I can run?

I have a bad mac keyboard which could 'unpress' or double press at any time so I would think the reset was performed when in fact it had not. I want to alleviate that doubt

  • 3
    This feels very much like an XY Problem Why do you think you need to reset these so frequently that it would require a shortcut? – Tetsujin Sep 21 '19 at 8:48
  • 1
    As you've presumably already done all the steps outlined in support.apple.com/HT201295 which will have taken 10 mins or so, I'm still not sure what the 2 minutes gain would really be. Aside from that, I don't think it's possible. These resets run below the OS, before anything else is loaded. – Tetsujin Sep 21 '19 at 8:53
  • 1
    @Tetsujin Thanks, appreciate the knowledge. The reason why I am after code is a simple copy/paste of code is much less likely to go wrong than pressing obscure shortcuts. I have a bad mac keyboard which could 'unpress' or double press at any time so I would think the reset was performed when in fact it had not. I want to alleviate that doubt – stevec Sep 21 '19 at 8:59
  • 1
    Sadly I don't know how to placate ;) It's just confusing to frequently read on this site "Why would you, you shouldn't unless…" when as answer "reset SMC" is perhaps more than a thousand times posted. It might be a XY here, but the question is really straightforward enough for me: 'reset all in one go, unattended after one action/keystroke.' (Maybe for testing purposes, or company procedure to decommission 200 Macs for resale?) – LаngLаngС Sep 21 '19 at 10:35
  • 1
    @LangLangC I totally agree. But I'd contend that efficiency, accuracy, simplification and certainty provide ample justification for wanting to codify such an operation. But economies of scale are also nice. – stevec Sep 21 '19 at 10:39
2

I'd try with a script using the following outline

sudo nvram -c

which should clear the contents of NVRAM.

curl 'https://sourceforge.net/projects/refind/files/0.11.4/refind-flashdrive-0.11.4.zip/download' --output refind.usbimage

copy SmcFlasher there (https://discussions.apple.com/thread/4855319?answerId=22024754022#22024754022)

shutdown -r now

and then you will have to manually follow the smcflasher instuctions up to

SmcFlasher.efi -reset 1

you can of course automate that as well by modifying the USB image accordingly and you'd be right where you want to be.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .