Your Mac has a media access control address (confusingly for Mac users, it’s called the MAC address) that uniquely identifies your laptop.
This string of letters and numbers is hard-coded into your device in the factory, so it’s impossible to change on a permanent basis. However, you can change this fingerprint temporarily, using a technique known as spoofing.
In this article I’m going to cover the reasons why you might want to spoof your MAC, before showing you how to generate a new address using macOS’ Terminal app.
Why should I spoof my MAC address?
There’s many reasons why you might want to change your MAC address, but here’s some of the most common ones:
Accessing a protected network
For increased security, some networks only accept connection requests from devices that have a pre-approved MAC address. If this is a network you use regularly, then ideally your Mac should already be registered as a valid connection, but if it isn’t, then you’ll need to spoof your address before connecting to that network.
Free Wi-Fi, for longer
Free public Wi-Fi is great, but it’s becoming increasingly common for these networks to be capped. Cafes, hotels, airports, and many other places that offer free Wi-Fi, are starting to block users once they reach a specific time or data limit.
If you find yourself unceremoniously kicked off a network, then you can often trick that network into seeing you as a new user, by changing your MAC address. Just make sure you play fair – spoofing your address so that you can quickly finish off a task is unlikely to inconvenience anyone, but you don’t want to be the person who spends hours hogging the free Wi-Fi at your local cafe!
Keep you private browsing, private
Tracking your MAC address is one of the ways that third parties can gather information about your online activities. Generating a new MAC address from time to time can make it more difficult for these third parties to track your browsing history.
Checking your hard-coded MAC address
You can change your MAC address via the Terminal, but since this information is hard-coded, your device will revert to its original MAC address upon restart. This automatic reset means you can always restore your Mac’s original address with a simple reboot. However, if you want the option of restoring the original address without restarting your Mac, then you’ll need to enter the original address into the Terminal.
If this sounds like something you might want to do, then you should make a note of your MAC address before you start the spoofing process. You can check your Mac’s hard-coded address, either via the Terminal or the System Preferences app.
- Select the ‘Apple’ logo from the menu bar.
- Select ‘Network.’
- In the left-hand menu, make sure ‘Wi-Fi’ is selected.
- Click the ‘Advanced…’ button.
- Select ‘Hardware.’
- Make a note of the ‘MAC address’ value.
- Launch your Mac’s Terminal, by navigating to ‘Applications > Utilities > Terminal.’
- Type the following command into the Terminal:
ifconfig en1 | grep ether
- Press the ‘Enter’ key on your keyboard. This returns your current MAC address – make a note of this value.
Change your MAC address
To generate a new MAC address at random, type the following command into your Mac’s Terminal and then press the ‘Enter key on your keyboard:
openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’ | xargs sudo ifconfig en0 ether
Your Mac will now be using a new address! If you want to check what this address actually is, then simply run the following Terminal command:
ifconfig en1 | grep ether
To switch back to your original address at any point, either restart your computer or enter the original MAC address into the Terminal, using the following command:
sudo ifconfig en0 ether your-MAC-address