Skip to content

Instantly share code, notes, and snippets.

@javahippie
Created July 30, 2018 15:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javahippie/6b641764755db60b7d6a2584a2a1ef4c to your computer and use it in GitHub Desktop.
Save javahippie/6b641764755db60b7d6a2584a2a1ef4c to your computer and use it in GitHub Desktop.
Short script to change the MAC Address on OSX
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "You need to run the file as root"
exit
fi
WIFI_INTERFACE=en0
NEW_MAC_ADDRESS=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
ifconfig $WIFI_INTERFACE ether $NEW_MAC_ADDRESS
echo Set MAC Address of $WIFI_INTERFACE to $NEW_MAC_ADDRESS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment