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
Following has been tested working on M4 macbook with macOS sequoia:
First, disassociate from the wifi AP you were connected to.
Run
ifconfig
to change the MAC:the command should run w/o error.
You can now see the newly set MAC address in:
Typically, the WiFi interface is
en0
. If not, you can get the correct interface when connected to an AP, during whichifconfig
shows ip address that the desired interface is using, which is typically prefixed with192...
. With this, you can find the interface accordingly.