Earliest way to disable wifi at login or boot
Solution 1:
You may be asking two different things, but in the last paragraph you said:
The ultimate goal is to prevent the system from automatically logging into a network
Prevent System From Automatically Logging Into a Network:
I think the way to accomplish that is to un-check (disable) the Auto-Join
feature for each WiFi network name/SSID that's stored. System Preferences
, Network
, Advanced...
. Uncheck all checked boxes in the "Preferred Networks" list.
Also note that there are a couple of other options here that may be of interest:
- You can uncheck the option to "Remember networks this computer has joined"
- You can check the box to "Require administrator authorization to: Turn Wi-Fi on or off.
To Disconnect WiFi Power at Boot Time:
To disconnect wifi power at boot time, you can use cron
. It's certainly simpler than building a .plist
, and it's invoked at boot instead of login. In my testing, it survives a login, but of course it could be "overruled" by other system settings -- YMMV. It can be re-started from the WiFi icon in the menu bar after login when you wish. Here's how to do this from the CLI:
crontab -e
This will start your designated crontab
editor, and open your current crontab
. If you don't have a crontab
(haven't used it previously), you'll be prompted to select from one of three choices for default editor. I'd suggest you choose pico
or nano
. That done, the default crontab
will be opened in the editor of your choice.
Once the editor has started, make the following entry on the first empty line at the "bottom" the file:
@reboot /usr/sbin/networksetup -setairportpower en0 off
Save and exit the editor, and your new crontab
becomes active. This command will now execute aach time your system boots, and (subject to the exception mentioned) your WiFi interface will be "OFF" until you turn it on.