BigSur: systemsetup throws an error, but executes anyway
I run some scripts to set up certain things when building a computer. Recently (ala Big Sur+) the specific commands to set things using systemsetup throw an error. It worked perfectly in the past, so something has changed, in fact I seem to recall it worked in earlier versions of BigSur.
This is the error:
2022-04-09 07:07:33.282 systemsetup[2738:43831] ### Error:2 File:/System/Volumes/Data/SWE/macOS/BuildRoots/9dc5c14c79/Library/Caches/com.apple.xbs/Sources/Admin/Admin-876.2/InternetServices.m Line:379
Here is a code example:
#!/usr/bin/perl
$TZ = "America/New_York";
$CMD="sudo /usr/sbin/systemsetup ";
print "set timezone\n\n";
`$CMD -settimezone Pacific/Wake`;
$curTZ = `$CMD -gettimezone`;
print "\n\n$curTZ\n\n";
`$CMD -settimezone $TZ`;
$curTZ = `$CMD -gettimezone`;
print "\n\n$curTZ\n\n";
Notes:
- even though it throws the error, it still sets the timezone correctly.
- the error is the same no matter what "-set" verb is used; timezone, timeserver, computersleep, etc.
Any thoughts?
Thanks.
Paul