SpoofMAC icon indicating copy to clipboard operation
SpoofMAC copied to clipboard

Mac address spoofing fails on Mac machines after OS update.

Open deathbychocolate opened this issue 5 months ago • 2 comments

The output of the error is the following:

/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/docopt.py:165: SyntaxWarning: invalid escape sequence '\S'
  name = re.findall('(<\S*?>)', source)[0]
/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/docopt.py:166: SyntaxWarning: invalid escape sequence '\['
  value = re.findall('\[default: (.*)\]', source, flags=re.I)
/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/docopt.py:207: SyntaxWarning: invalid escape sequence '\['
  matched = re.findall('\[default: (.*)\]', description, flags=re.I)
/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/docopt.py:456: SyntaxWarning: invalid escape sequence '\S'
  split = re.split('\n *(<\S+?>|-\S+?)', doc)[1:]
/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/spoofmac/interface.py:50: SyntaxWarning: invalid escape sequence '\w'
  m = re.search("(?<=\w\s)(.*)(?=\sbrd)", result)
/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/spoofmac/interface.py:70: SyntaxWarning: invalid escape sequence '\d'
  details = re.findall("^[\d]+:(.*)", output, re.MULTILINE)
/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/spoofmac/interface.py:71: SyntaxWarning: invalid escape sequence '\s'
  more_details = re.findall("[\s]+link(.*)", output,re.MULTILINE)
/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/spoofmac/interface.py:203: SyntaxWarning: invalid escape sequence '\C'
  WIN_REGISTRY_PATH = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"
/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/spoofmac/interface.py:216: SyntaxWarning: invalid escape sequence '\s'
  query = '('+description+'\r\n\s*.*:\r\n\s*)PCI\\\\(([A-Z]|[0-9]|_|&)*)'
WARNING: The airport command line tool is deprecated and will be removed in a future release.
For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool.
ifconfig: ioctl (SIOCAIFADDR): Can't assign requested address
Traceback (most recent call last):
  File "/opt/homebrew/bin/spoof-mac", line 138, in <module>
    sys.exit(main(arguments, root_or_admin))
             ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/bin/spoof-mac", line 118, in main
    set_interface_mac(device, target_mac, port)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/spoofmac/interface.py", line 540, in set_interface_mac
    spoofer.set_interface_mac(device, mac, port)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/spoof-mac/2.1.1_5/libexec/lib/python3.13/site-packages/spoofmac/interface.py", line 450, in set_interface_mac
    subprocess.check_call([
    ~~~~~~~~~~~~~~~~~~~~~^^
        'ifconfig',
        ^^^^^^^^^^^
    ...<2 lines>...
        mac
        ^^^
    ])
    ^^
  File "/opt/homebrew/Cellar/[email protected]/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 419, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ifconfig', 'en0', 'ether', '00:1C:42:7B:49:67']' returned non-zero exit status 1.

This is due to Apple adding a new 'security' feature to disallow changing the Mac address via the network interface management tools directly, for example:

  • /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport or
  • networksetup

The workaround seems to be the following (gotten from a comment by @loekloekloek from this youtube video):

"Can't assign requested address" fix (on MacBook M4 chip):
First you have to erase the automatic recognition of the public network you were on. Keep WiFi enabled, and click "forget this network" of the WiFi network name.
Get interface (en0, en1, etc…) that WiFi runs on (opt + apple icon upper left -> system information -> network tab), like shown in video.
Enter in terminal: “sudo ifconfig en0 ether up”
Enter in terminal: “sudo ifconfig en0 ether”
Should show MAC address currently, copy that
Enter in terminal: “sudo ifconfig en0 ether < paste MAC address >”
Enter in terminal: “sudo ifconfig en0 ether < paste MAC address and slightly alter by one digit >”
Done.

Please, make the necessary changes to fix for MacOS users.

deathbychocolate avatar Aug 25 '25 00:08 deathbychocolate

Doesn't work on sequoia 15.6 - I can set current but different gets can't assign requested address

marek-knappe avatar Sep 16 '25 00:09 marek-knappe

solution details: https://github.com/feross/SpoofMAC/issues/123#issuecomment-3397547602

LaureatePoet avatar Oct 13 '25 13:10 LaureatePoet