Skip to content

Instantly share code, notes, and snippets.

@thesauri
Last active July 26, 2025 22:13
Show Gist options
  • 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 Sequoia

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:

  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
@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

@mbierman
Copy link

@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?

@Nsure45
Copy link

Nsure45 commented May 11, 2024

If you change en0 to en1 I noticed it bypasses things such as Internet parental controls. But if you use en0 it doesn't work. Is this because en0 is the ethernet Mac address and en1 is the WIFI MAC address?

@Trung-DV
Copy link

Trung-DV commented Sep 1, 2024

I found that ifconfig: ioctl (SIOCAIFADDR): Can't assign requested address because that my MacBook still connect to wifi. Just disconnect and run sudo ifconfig en0 ether <mac-address-here>, no error exist.

@foxhoundsk
Copy link

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:

sudo ifconfig en0 ether <your-desired-mac>

the command should run w/o error.

You can now see the newly set MAC address in:

sudo ifconfig | less # search en0 to quickly locate the interface 

Typically, the WiFi interface is en0. If not, you can get the correct interface when connected to an AP, during which ifconfig shows ip address that the desired interface is using, which is typically prefixed with 192.... With this, you can find the interface accordingly.

@limitay
Copy link

limitay commented Mar 6, 2025

this gives me the same permission denied error as stated earlier in the thread...

@foxhoundsk
Copy link

foxhoundsk commented Mar 8, 2025

this gives me the same permission denied error as stated earlier in the thread...

@limitay Considering you didn't use quote, are you trying my approach? If yes, do you have the WiFI switch disabled? The switch shouldn't be disabled, simply disassociate the AP you were connected to.

@SunCreation
Copy link

Thanks a lot!

@DHUB7376736
Copy link

this gives me the same permission denied error as stated earlier in the thread...

@limitay Considering you didn't use quote, are you trying my approach? If yes, do you have the WiFI switch disabled? The switch shouldn't be disabled, simply disassociate the AP you were connected to.

I have tried everything. All the commands. Trying to restart the mac to close anything that might be affecting it (little snitch). I tried with macchanger, but it does a infinite loop of errors.
Screenshot 2025-06-25 at 9 50 29 pm

@foxhoundsk
Copy link

this gives me the same permission denied error as stated earlier in the thread...

@limitay Considering you didn't use quote, are you trying my approach? If yes, do you have the WiFI switch disabled? The switch shouldn't be disabled, simply disassociate the AP you were connected to.

I have tried everything. All the commands. Trying to restart the mac to close anything that might be affecting it (little snitch). I tried with macchanger, but it does a infinite loop of errors. Screenshot 2025-06-25 at 9 50 29 pm

@DHUB7376736 Have you disaccosiated the AP before issuing the "MAC addr changing" command?

Specifically, see my previous comment.

@DHUB7376736
Copy link

this gives me the same permission denied error as stated earlier in the thread...

@limitay Considering you didn't use quote, are you trying my approach? If yes, do you have the WiFI switch disabled? The switch shouldn't be disabled, simply disassociate the AP you were connected to.

I have tried everything. All the commands. Trying to restart the mac to close anything that might be affecting it (little snitch). I tried with macchanger, but it does a infinite loop of errors. Screenshot 2025-06-25 at 9 50 29 pm

@DHUB7376736 Have you disaccosiated the AP before issuing the "MAC addr changing" command?

Specifically, see my previous comment.

If by AP you are referring to wifi, then yes. I tried: networksetup -setairportpower en0 off I have also done it manually. Maybe it just isn’t functioning at all for Sequoia.

@johan13
Copy link

johan13 commented Jul 26, 2025

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:

networksetup -setairportpower en0 off ; networksetup -setairportpower en0 on ; sudo ifconfig en0 ether XX:XX:XX:XX:XX:XX

(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.)

@mbierman
Copy link

@johan13 Thank you. That works for Wi-Fi, but not for Ethernet unfortunately. Still better than nothing though.

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