Skip to content

Instantly share code, notes, and snippets.

@Flushot
Created June 14, 2013 22:14
Show Gist options
  • Save Flushot/5785697 to your computer and use it in GitHub Desktop.
Save Flushot/5785697 to your computer and use it in GitHub Desktop.
Shell script to change MAC address on OSX
#!/bin/sh
IFACE=en0
macaddr=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
sudo airport -z
osascript -e 'tell application "System Preferences" to quit'
sudo scselect -n
sudo ifconfig $IFACE lladdr $macaddr
# These should match
echo $macaddr
ifconfig $IFACE | grep ether
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment