Skip to content

Instantly share code, notes, and snippets.

@benkant
Created July 12, 2022 01:57
Show Gist options
  • Save benkant/6954638d1c4f6e18724c451e0c7678d3 to your computer and use it in GitHub Desktop.
Save benkant/6954638d1c4f6e18724c451e0c7678d3 to your computer and use it in GitHub Desktop.
Set en0 to a random MAC address on macOS
#!/usr/bin/env bash
# Set en0 to a random MAC address on macOS
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
openssl rand -hex 6 | sed 's!\.!!g;s!\(..\)!\1:!g;s!:$!!' | xargs -t -0 sudo ifconfig en0 lladdr
sudo ifconfig en0 up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment