TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to randomize your MAC address on OS X

81 pointsby FredericJalmost 11 years ago

18 comments

FootballMusealmost 11 years ago
How I&#x27;ve been doing it for years:<p><a href="https://github.com/feross/SpoofMAC" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;feross&#x2F;SpoofMAC</a><p>&gt; spoof-mac randomize en0
评论 #7875937 未加载
评论 #7874346 未加载
评论 #7875538 未加载
columnalmost 11 years ago
Hi, isn&#x27;t Python now shipping with OSX? I haven&#x27;t tested it, but wouldn&#x27;t this also work while being more readable? (DISCLAIMER: I haven&#x27;t tested it. Also, I haven&#x27;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) &gt; 1: # get network interface from cmdline parameter intf = argv[1] else: # get network interface from ENVIRONMENT variables intf = getenv(&#x27;INTERFACE&#x27;, &#x27;&#x27;) if intf: # generate random mac address r = lambda: randint(0,255) randmac = &#x27;%02X:%02X:%02X:%02X:%02X:%02X&#x27; % (r(),r(),r(),r(),r(),r()) # change mac address call([&quot;ifconfig&quot;, &quot;%s hw ether %s&quot; % (intf, randmac)]) else: print &quot;Couldn&#x27;t determine network interface&quot;</code></pre>
评论 #7873624 未加载
评论 #7873550 未加载
评论 #7878237 未加载
评论 #7876972 未加载
zufallsheldalmost 11 years ago
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:&#x2F;&#x2F;github.com&#x2F;alobbs&#x2F;macchanger</a> [1]<a href="https://www.zufallsheld.de/2013/08/07/mac-spoofing-under-linux/" rel="nofollow">https:&#x2F;&#x2F;www.zufallsheld.de&#x2F;2013&#x2F;08&#x2F;07&#x2F;mac-spoofing-under-lin...</a>
评论 #7874075 未加载
jackgaviganalmost 11 years ago
Alternatively...<p><pre><code> sudo ifconfig en1 ether `openssl rand -hex 6 | sed &#x27;s&#x2F;\(..\)&#x2F;\1:&#x2F;g; s&#x2F;.$&#x2F;&#x2F;&#x27;` </code></pre> Credit where it&#x27;s due: <a href="http://osxdaily.com/2012/03/01/change-mac-address-os-x/" rel="nofollow">http:&#x2F;&#x2F;osxdaily.com&#x2F;2012&#x2F;03&#x2F;01&#x2F;change-mac-address-os-x&#x2F;</a>
eliot_sykesalmost 11 years ago
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:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7864813</a>
评论 #7874785 未加载
jarinalmost 11 years ago
If I&#x27;m not mistaken, the author recommends saving the file to<p><pre><code> &#x2F;opt&#x2F;local&#x2F;etc&#x2F;oui.txt </code></pre> but the plist runs<p><pre><code> bash &#x2F;opt&#x2F;local&#x2F;bin&#x2F;macrandomize.sh </code></pre> I think one or the other probably needs to be changed, unless I&#x27;m missing something here.
评论 #7873084 未加载
评论 #7873177 未加载
zurnalmost 11 years ago
You want unpredictable random numbers, so using bash $RANDOM is no good. hexdump + &#x2F;dev&#x2F;urandom + sed would work, incantation left as an exercise to reader as I don&#x27;t have a Mac around to check limitations of their hexdump(1)...<p>(Same goes for the Python solution posted in another comment here).
评论 #7874976 未加载
fascinatedalmost 11 years ago
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.
评论 #7873465 未加载
评论 #7873247 未加载
vrikisalmost 11 years ago
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.
ohwpalmost 11 years ago
I was wondering: why did they decide to randomize the address? Why not use the same address for every device?
评论 #7873589 未加载
评论 #7873007 未加载
评论 #7873053 未加载
评论 #7873024 未加载
desertjedialmost 11 years ago
Hey, is there a way this could be done under Windows? Run from a batch file for example?
Throw67F4D509almost 11 years ago
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.
erkosealmost 11 years ago
I prefer adapting the method described in Unique Local IPv6 Unicast Addresses <a href="https://tools.ietf.org/html/rfc4193" rel="nofollow">https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc4193</a>
kccqzyalmost 11 years ago
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.
评论 #7876336 未加载
TheLoneWolflingalmost 11 years ago
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&#x27;s worth it.
mwfunkalmost 11 years ago
Tangential, but it&#x27;s actually heartwarming to me that so far every commenter seems to understand that the &quot;MAC&quot; 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.
评论 #7875552 未加载
评论 #7876216 未加载
dmmalamalmost 11 years ago
Does OSX Yosemite have the mac randomization like ios8?
zomgalmost 11 years ago
i use linkliar <a href="https://github.com/halo/LinkLiar" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;halo&#x2F;LinkLiar</a>