Every network card on your system, be it your WiFi or the regular ethernet, will have its own unique identification address called MAC (Media Access Control) address. This address is usually used to identify your computer on the network. However, you sometimes may find yourselves in a situation where you need to spoof or change the MAC address. So, if you ever want to spoof or change MAC address in your OS X system, here is how to do it the easy way.
Change MAC Address in OS X
Though there are several free applications that let you change the MAC address with just a few clicks. You don't have to use those applications as you can do it yourself with just a couple of commands.
To start off, search for the terminal in the Launchpad or Spotlight and open it.
Once the terminal has been opened, the first thing you need to do is find what your current MAC address is. This helps you cross check once you've changed the MAC address.
To know your current MAC address, simply execute the below command and it will display the current MAC address.
ifconfig en0 | grep ether
Once you got your current MAC address, its time to change it. To change the MAC address, execute the below command while replacing MAC address in it with whatever MAC address you want. If you want a random MAC address then you can use this web tool.
sudo ifconfig en0 ether a1:2d:a9:10:6a:ad
Alternatively, you can use the below command to generate a random MAC address for your system.
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' | xargs sudo ifconfig en0 ether
To verify the change of MAC address, use the first command and it will display the changed MAC address.
That's all there is to do and it is that simple to spoof or change MAC address in OS X. However, the MAC address in your system is hard coded into the network devices. Which simply means that the changes you just made are temporary and as soon as you restart your system, your MAC address will reset to original.
That being said, if you want a random MAC address every time your log into your system, you can create a script using the above commands and add it to the startup programs.
Hopefully that helps and do comment below sharing your thoughts and experiences about using the above method to spoof or change MAC address in Mac OS X.