I was unable to change the MAC address of the Wi-FI device on a MacBook Air (M1 2020) running macOS Sequoia due to the following error: ifconfig: ioctl (SIOCAIFADDR): Can't assign requested addres
.
By running the commands in following sequence I was able to change it successfully:
- Turn WiFi device off
- Turn the WiFi device on again:
networksetup -setairportpower en0 on
- Change the MAC:
ifconfig en0 ether <mac-address-here>
- Run:
networksetup -detectnewhardware
On Sequoia 15.4.1 I get "ifconfig: ioctl (SIOCAIFADDR): Can't assign requested address" if I try to change the MAC address while the Wi-Fi is off. But it works fine immediately after Wi-Fi has been enabled, before it has connected to an AP.
I.e. this works on my machine:
(I stumbled on this Gist when from a Google search. Maybe this will help future Googlers - or even myself the next time I need to spoof a MAC address.)