Created
October 19, 2017 21:25
-
-
Save badstreff/2dff8bb29648ff6f2a815b96ea246ebc to your computer and use it in GitHub Desktop.
Set Firmware Password macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Test for firmware password. If no firmware password set it. | |
fwpwdset="$(firmwarepasswd -check | sed 's/^.*: / /')" | |
if [ "$fwpwdset" = "No" ];then | |
echo "Firmware Password not set. Setting firmware password." | |
/usr/bin/expect << EOF | |
spawn firmwarepasswd -setpasswd | |
expect "Enter new password:" | |
send "$4\r"; | |
expect "Re-enter new password:" | |
send "$4\r"; | |
interact | |
EOF | |
else | |
echo "Firmware password already set." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment