How to change the MAC address of our Mac using Terminal

A few days ago we saw how with iOS 14, iPadOS 14 and watchOS 7 Apple offers us the option to hide the MAC address of our network card to prevent Wi-Fi network providers from tracking us. Although this functionality has not reached the Mac, at least for now, a simple Terminal command is enough to achieve the same effect.

Hello, my name is a1: b1: c1: d1: e1: f1

When we connect to a Wi-Fi network, the access point with which we do it, which in our house is the router, you need to identify our device. Why? Because you need to know what traffic to direct to each device, so it is important that you distinguish between them.

For this distinction, the MAC (media access control) address is used, which we could understand as the license plate of the network card. This license plate is embedded in the manufacture of the same card and never changes, so there is the possibility that the network operator or other observers on the network may relate our device to certain data. A relationship that includes both the activity on the network, such as DNS requests, as well as our location in various access points, such as in a museum and its different rooms.

Changing the MAC address of our network card is quite simple, The steps are the following:

  • We open the Terminal app on our Mac.
  • Copy and paste: sudo ifconfig en0 ether $ (openssl rand -hex 6 | sed ‘s / (..) / 1: / g; s /.$//’)
  • We press Enter (↩︎).
  • We write the password of our computer.
  • We press Enter again.
  • If instead of a random MAC we want to use our own address, we can use the command “sudo ifconfig en0 ether ”where the address will need a format a1: b1: c1: d1: e1: f1. Once the change is made a simple click on the Wi-Fi icon in the menu bar while holding down the option key will indicate the new address at the top of the menu. For now it seems that this system still does not work in macOS Big Sur which, on the other hand, is still in beta.

    Easy and efficient, either to get a little more time on the airport Wi-Fi or because we simply do not want the network operator to be able to meet us every time we go to Starbucks to work with our Mac, Terminal is at our disposal.