Change a MAC address in macOS

Start the Terminal App by going to Applications -> Utilities -> Terminal. This will enable you to submit command line instructions to the kernel.

Display your current MAC address on interface “en0” using the command shown below. Note the hexadecimal value in the “ether” field. This is your MAC address.

sudo ifconfig en0

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,
MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_HWTAGGING>
ether f6:e5:d4:c3:b2:a1
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (none)
status: inactive

To change the MAC address of interface “en0” of a computer running macOS run the following command :

sudo ifconfig en0 ether a1:b2:c3:d4:e5:f6

To display the altered MAC address on interface “en0′ type the command shown below:

sudo ifconfig en0

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,
MULTICAST> mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_HWTAGGING>
ether a1:b2:c3:d4:e5:f6
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (none)
status: inactive

Clear local DNS cache in macOS

To flush the local DNS cache for an Apple Mac running macOS 12.x (Sierra) or later do the following.

Start the Terminal App by going to Applications -> Utilities -> Terminal. Then, type the following command and press the ENTER key to execute:

sudo dscacheutil -flushcache

Now type the next command shown below followed by the ENTER key to execute:

sudo killall -HUP mDNSResponder

Now type the final command shown below followed by the ENTER key to execute:

sudo killall mDNSResponderHelper