Skip to content

Instantly share code, notes, and snippets.

@28
Created January 9, 2019 21:32
Show Gist options
  • Select an option

  • Save 28/4fbaa8a7416751014d058657f1d74524 to your computer and use it in GitHub Desktop.

Select an option

Save 28/4fbaa8a7416751014d058657f1d74524 to your computer and use it in GitHub Desktop.
Change your MAC address to a random value
#!/usr/bin/env bash
a=$(ifconfig en0 | grep ether | sed -e 's/^[[:space:]]*ether//')
echo "Current MAC address:$a"
r=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
echo "New MAC address: $r"
echo $r | xargs sudo ifconfig en0 ether
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment