I am making a shell script for my mac and part of it requires connecting to my school's wifi network.
I have tried both of the following commands and while the settings wifi tab says that the computer has connected, it does not get DHCP nor authenticate with with EAP-PEAP. After about a minute, the wifi icon in the menu bar gets an exclamation mark. Eventually
networksetup -setairportnetwork en0 <network name> <username> <password> --eapmethod PEAP --innerauth MSCHAPv2
networksetup -setairportnetwork en0 <network name> <username> <password>
What is strange is that I am able to succsesfully connect to a wpa2 network using the networksetup -setairportnetwork en0 <network name> <username> <password>
command. Also, I can connect to the school network just fine by clicking connect in settings.
Other info: OS: MacOS 14.4.1, Network uses EAP-PEAP (MSCHAPv2)