Change your MAC address on OS X

30 Aug 2013

This is a small snippet which you can put in your .bash_profile or .zshrc to easily change you MAC address on OS X.


function newmac(){
    NEWMAC=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
    sudo ifconfig en0 ether $NEWMAC
    echo "New MAC is"
    echo $(ifconfig en0 | grep ether)
}

When you have put that in the file you can simply type “newmac” to change to a new random mac (after ‘source ~/.bash_profile’ ofc).
To select which mac to use manually just change the NEWMAC variable.

Based on this tutorial.

blog comments powered by Disqus