Generate and Set a Random Valid MAC Address from the Command Line in OS X

We’ve shown you how to generate MAC addresses randomly and then how to go about changing a MAC address in OS X Lion and OS X Mountain Lion, but why have those be two separate actions? Using the command line, you can combine the two events into a single action to generate a valid MAC and then set it immediately.
Launch the Terminal and paste the following onto a single line:
openssl rand -hex 1 | tr '[:lower:]' '[:upper:]' | xargs echo "obase=2;ibase=16;" | bc | cut -c1-6 | sed 's/$/00/' | xargs echo "obase=16;ibase=2;" | bc | sed "s/$/:$(openssl rand -hex 5 | sed 's/\(..\)/\1:/g; s/.$//' | tr '[:lower:]' '[:upper:]')/" | xargs sudo ifconfig en0 ether
There is no confirmation or output, the MAC address is set immediately which you can verify with the following command:
ifconfig en0 |grep ether
You will probably need to reconnect to the wireless router after issuing the command, and in some cases turn wi-fi on and off again.
If you intend on using this often, setting up an alias in .bash_profile would be a good idea to avoid having to cut and paste the massive block of text.
Thanks to osmium for the great tip




Each time you connect an iPhone, iPad, or iPod to a computer, iTunes launches and immediately begins to automatically sync all content between the iOS device and the connected computer. 










