5 ms·
Nice, added it as a bash alias. alias randommac='sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en0 -z && s
by tommoor 1y ago
Nice, added it as a bash alias.
alias randommac='sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en0 -z && sudo ifconfig en0 ether $(openssl rand -hex 6 | sed "s/../&:/g; s/:$//")'
- commandersaki 1y agoSo I tried this out on macOS 26 and the `airport` command is no longer there. There is a `airportd.sb` file, which appears to be some permissions based thing in s-expression/LISP. Weird. Edit: Spun up a macOS 15 VM and I got this: WARNING: The airport command line tool is deprecated and will be removed in a future release. For diagnosing Wi-Fi related issues, use the Wireless Diagnostics app or wdutil command line tool. I guess they weren't kidding.
- bc569a80a344f9c 1y agoLooking around briefly, you can replace it with this: `networksetup -setairportpower en0 on && [... set MAC ...] && networksetup -setairportpower en0 off` I think it's pretty safe to assume that modern Macs will always have en0 as the WiFi adapter, but if you wanted, you could use `networksetup -listnetworkserviceorder` to find the associated device.
- JonathonW 1y agoModern Macs do not always have en0 as the WiFi adapter (it's en1 on current iMacs and on the Mac Studio; en0 is the ethernet jack). But you're unlikely to be taking one of the machines that has built-in ethernet to the airport or coffeeshop.
- bc569a80a344f9c 1y agoDuh, also true on my Mac Mini. But yeah, “modern Mac laptops” probably makes the statement correct enough and still describes the entire set of targets.
- commandersaki 1y agoSo this doesn't work if your wifi nic is associated with an SSID. `airport -z` disassociates the SSID. Can't seem to find a CLI command to do the same in macOS 26, but I haven't looked too hard either.
- msdrigg 1y agoAirport has been deprecated for a year or two. Here's an article talking about its deprecation and its relatively nonfunctional replacement: wdutil https://www.intuitibits.com/2024/03/14/goodbye-airport/ https://www.intuitibits.com/2024/03/14/goodbye-airport/