How I've been doing it for years:<p><a href="https://github.com/feross/SpoofMAC" rel="nofollow">https://github.com/feross/SpoofMAC</a><p>> spoof-mac randomize en0
Hi, isn't Python now shipping with OSX? I haven't tested it, but wouldn't this also work while being more readable?
(DISCLAIMER: I haven't tested it. Also, I haven't tested it.)<p><pre><code> from random import randint
from os import getenv
from subprocess import call
from sys import argv
if len(argv) > 1:
# get network interface from cmdline parameter
intf = argv[1]
else:
# get network interface from ENVIRONMENT variables
intf = getenv('INTERFACE', '')
if intf:
# generate random mac address
r = lambda: randint(0,255)
randmac = '%02X:%02X:%02X:%02X:%02X:%02X' % (r(),r(),r(),r(),r(),r())
# change mac address
call(["ifconfig", "%s hw ether %s" % (intf, randmac)])
else:
print "Couldn't determine network interface"</code></pre>
On Linux, you can use macchanger[0], a tool which does this automatically for you. I wrote about it here[1].<p>[0]<a href="https://github.com/alobbs/macchanger" rel="nofollow">https://github.com/alobbs/macchanger</a>
[1]<a href="https://www.zufallsheld.de/2013/08/07/mac-spoofing-under-linux/" rel="nofollow">https://www.zufallsheld.de/2013/08/07/mac-spoofing-under-lin...</a>
Elsewhere on HN in case you missed it - random MAC addresses are coming to iOS8: <a href="https://news.ycombinator.com/item?id=7864813" rel="nofollow">https://news.ycombinator.com/item?id=7864813</a>
If I'm not mistaken, the author recommends saving the file to<p><pre><code> /opt/local/etc/oui.txt
</code></pre>
but the plist runs<p><pre><code> bash /opt/local/bin/macrandomize.sh
</code></pre>
I think one or the other probably needs to be changed, unless I'm missing something here.
You want unpredictable random numbers, so using bash $RANDOM is no good. hexdump + /dev/urandom + sed would work, incantation left as an exercise to reader as I don't have a Mac around to check limitations of their hexdump(1)...<p>(Same goes for the Python solution posted in another comment here).
Does this even work on the wireless interface on a mbp? The driver used to prevent you from setting the MAC addr to anything you wanted, vs the ethernet driver for the wired interface that lets you play with it freely.
I wrote my own little terminal commands back when I had a 5 hour lay-over in Charles de Gaulle Airport (Paris). At the time, they offered 15 minute free wifi, so I just ran my little tool and it worked a treat.
Be careful. Randomizing your MAC address may make your computer stick out more than if you pick a single legitimate looking MAC address and stick with it for a while. Not all 16 million MAC prefixes have been sold to manufacturers yet.
I prefer adapting the method described in Unique Local IPv6 Unicast Addresses <a href="https://tools.ietf.org/html/rfc4193" rel="nofollow">https://tools.ietf.org/html/rfc4193</a>
One of my friends also told me Dropbox uses MAC address to identify computers. He wrote a similar script to get lots of referrals and free space on Dropbox. Probably against their Terms though.
I have my computer set up to randomize MAC address on boot, on both partitions.<p>There are some downsides (having to relogin to certain wireless networks every boot) but by-and-large it's worth it.
Tangential, but it's actually heartwarming to me that so far every commenter seems to understand that the "MAC" in the title refers to Media Access Control, rather than a comically incorrect way of spelling the name of the computers that OS X runs on.