How to change your MAC Address on macOS

Changing the MAC address on your MacBook can be useful for a variety of reasons. One common reason is for privacy and security purposes, as the MAC address can be used to track and identify a device on a network. Some networks may have restrictions in place that only allow devices with certain MAC addresses to connect. By changing your MAC address, you may be able to bypass these restrictions and connect to the network.

It's worth noting that changing the MAC address on macOS can be more difficult compared to other operating systems, and the change is only temporary. By default, macOS resets the MAC address every reboot. Additionally, changing the MAC address can cause issues with network connectivity and may not be allowed on certain networks. While it is possible to change the MAC address on macOS, it's important to understand the potential risks and limitations before doing so.

First fully disable Wi-Fi

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z

Generate MAC Address

openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/:$//'

Set MAC Address

sudo ifconfig en0 ether <MAC ADDRESS>
Replace MAC address with the one you generated

You've successfully changed your MAC Address!

Script it up

Create Script file

cd Desktop && nano mac-changer.sh

Paste the following contents:

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z 

# Generate a random MAC address
function generate_mac() {
    openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/:$//'
}

# Set the initial MAC address
macaddr=$(generate_mac)

# Try to assign the MAC address to the en0 interface
while ! sudo ifconfig en0 ether $macaddr; do
    echo "Failed to set MAC address to $macaddr"
    macaddr=$(generate_mac)
done

echo "Successfully set MAC address to $macaddr"

Exit: Control & X

Give the script execute permissions

chmod u+x mac-changer.sh

Give it a run

sudo mac-changer.sh

Run with a double click

Right click the file in finder and open in other:
Finder Screenshot - Opening with other

  1. Search "Terminal" top right
  2. Enable: All Applications
  3. Always Open With
  4. Then select open

Finder Screenshot - Opening with other

You can now double click the file to change your MAC Address!