Why is Cron not running the enable wifi command?
I'm trying to get something similar to work too (using the -setairportnetwork option)
My WiFi access point is misbehaving, and sometimes restarts. When it does that, many of my MacOS systems do not automatically reconnect, and this is very inconvenient for my Mac mini that does not have a keyboard, mouse, or ethernet attached.
From the networksetup &quot;man&quot; page (man networksetup)

The networksetup command requires at least
admin privileges to change network settings. If the &quot;Require an administrator password to access system-wide preferences&quot; option is selected in System Preferences &gt;
Security &amp; Privacy, then root privileges are required to change network settings.

But I expect there's something different about the context in which cron runs a user's job than when it runs whilst logged into the desktop.
In my case, when it fails it outputs the following:
Error: -3930  The operation couldn’t be completed. (com.apple.wifi.apple80211API.error error -3930.)

and the only place I can find error &quot;3930&quot; documented is in Jonathan Levin's &quot;new OS X Book&quot; notes, unfortunately &quot;Operation not permitted&quot; isn't much to go on.
Perhaps Marc is indeed thinking in the right direction, at least that if not running interactively as a &quot;Desktop&quot; user then it needs to run as root. Going to try that, next, and report back...
TBC.