- disconnect from the wifi (don't turn the adapter off)
- generate a mac address like
mac_address="$(networksetup -listallhardwareports | awk -v RS= '/en0/{print $NF}' | head -c 8):$(openssl rand -hex 3 | sed 's/\(..\)/\1:/g; s/.$//')"
sudo ifconfig en0 ether "$mac_address"
networksetup -detectnewhardware
- Check the spoofed mac with
ifconfig en0 | grep ether | awk '{print $2}' and networksetup -listallhardwareports | awk -v RS= '/en0/{print $NF}'
Courtesy feross/SpoofMAC#87 (comment)