Skip to content

Instantly share code, notes, and snippets.

@thesauri
Created February 22, 2022 15:38
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thesauri/022a307234eb3296fae6487cacc1fc1f to your computer and use it in GitHub Desktop.
Save thesauri/022a307234eb3296fae6487cacc1fc1f to your computer and use it in GitHub Desktop.
Change MAC address macOS 12 Monterey

Change MAC address in macOS Monterey

I was unable to change the MAC address of the Wi-FI device on a MacBook Air (M1 2020) running macOS Monterey 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:

  1. Turn WiFi device off
  2. Turn the WiFi device on again: networksetup -setairportpower en0 on
  3. Change the MAC: ifconfig en0 ether <mac-address-here>
  4. Run: networksetup -detectnewhardware
@airlariken
Copy link

THANKS A LOT, THIS REALLY HELP on Macbook Pro(15inch 2019) macOS 13.3 Monterey !!!!

@mbierman
Copy link

mbierman commented Apr 26, 2022

I get

ifconfig: ioctl (SIOCAIFADDR): permission denied

after step 2

@gchai
Copy link

gchai commented May 11, 2022

ifconfig: ioctl (SIOCAIFADDR): permission denied

Try sudo before, so sudo ifconfig en0 ether <mac-address-here>
You also have to run that command before it connects to a known wifi network it seems.

@phush0
Copy link

phush0 commented Aug 25, 2022

it is not working for ethernet adapter

@gchai
Copy link

gchai commented Aug 25, 2022

it is not working for ethernet adapter

en0 needs to be replaced with your ethernet port. You can use ifconfig to identify it.

@mbierman
Copy link

ifconfig: ioctl (SIOCAIFADDR): permission denied

Try sudo before, so sudo ifconfig en0 ether <mac-address-here> You also have to run that command before it connects to a known wifi network it seems.

sudo didn't solve the issue.

@mbierman
Copy link

mbierman commented Aug 25, 2022

FYI I turned this into a script if anyone is interested. https://gist.github.com/mbierman/03b2a962ac04963ef5bbc8354d0ed5d1

It handles Wi-Fi and Ethernet. Not as "fully automated" as I'd like but makes it easier.

@phush0
Copy link

phush0 commented Aug 26, 2022

it is still not working

@phush0
Copy link

phush0 commented Aug 26, 2022

ifconfig: ioctl (SIOCAIFADDR): Can't assign requested address

@gchai
Copy link

gchai commented Aug 26, 2022

The system does some sort of validation of the MAC address so not all of them will work.
Try the script I made: https://github.com/gchai/macos-mac-address-changer/

@phush0
Copy link

phush0 commented Aug 26, 2022

I am copping from one adapter to other so it have to be valid

@gchai
Copy link

gchai commented Aug 26, 2022

Are they both plugged into the same computer? The OS might prevent collisions.

@phush0
Copy link

phush0 commented Aug 26, 2022

Plugged first copy mac, unplug second one is in thunderbolt dock and try to set it and it is always no go.

@phush0
Copy link

phush0 commented Aug 26, 2022

will try with random mac to see if it is working at all

@phush0
Copy link

phush0 commented Aug 26, 2022

no it is not working with random mac too

@gchai
Copy link

gchai commented Aug 26, 2022

Same behavior on my TS3 Plus's ethernet port, maybe the TS3 Plus's chipset does not allow for MAC address changes?

@phush0
Copy link

phush0 commented Aug 26, 2022

I have tried with 3 different cards which I can change mac under Linux, and they are not working under Macos so problem is in Mac. Probably they have enabled only WiFi spoofing.

@phush0
Copy link

phush0 commented Aug 26, 2022

one thunderbolt doc, usb ethernet from dell and old TB2 mac ethernet all work under linux and I can change MACs

@phush0
Copy link

phush0 commented Sep 12, 2022

Sorry for late replay but it is not working even with latest script variant. Also strange enough is that it says that interface is Wi-Fi in self detect. But result is same ifconfig: ioctl (SIOCAIFADDR): Can't assign requested address

edit: tested on the Macpro Wi-Fi script is working for it, but it is not working for ethernet at all

@mbierman
Copy link

@phush0 if you are referring to the script I posted, let's move the discussion there. If not, please ignore. :)

@Wafeeqrox
Copy link

config: ioctl (SIOCAIFADDR): permission denied what does this mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment