4 December 2009 Tutorials 26 Comments

Spoofing your MAC address in Snow Leopard

Spoofing your MAC address in Snow Leopard

A MAC address, sometimes also refereed to as “physical address” is a unique identifier assigned to every network device. Contrarily to the IP address, which can change dynamically, a MAC address is a bit like a serial number intended to differentiate every network device on the planet. Here’s what it looks like : 01:23:45:67:89:ab.

Changing or “spoofing” your MAC address can be desired for multiple reasons and is quite simple to do in Snow Leopard.

In this tutorial, we’ll assume you want to change your wireless adapter’s physical address.

To find out what is your AirPort card’s current MAC address, type this in the Terminal.

ifconfig en1 | grep ether

Step 1 : disassociate from all wireless networks

This means to disconnect all current wireless network connections while leaving AirPort enabled.

Open the Terminal and paste this command :

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

You will be asked for your password to execute this command.

The airport command is part or Apple’s Apple80211 framework. Essentially, it’s what connects you to Wifi networks. The -z option disassociates from any network.

Tip: You can set up a simpler access to the airport command by creating a symbolic link. To do this, paste the following command in the Terminal:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport

Next time, you will simply need to type ariport -z to disassociate. You may also use airport -I to get information on your current connection.

Step 2: Change your MAC address

Once disassociated from the wireless network. You can change the MAC address with:

sudo ifconfig en1 ether 00:00:00:00:00:00

You can of course enter what ever you want as long as it is in the correct format. You can verify with ifconfig en1 | grep ether that your address is changed.

To revert your MAC address back to its default, simply reboot your machine.

  • http://sebastiencouture.com/ Sebastien Couture

    That's cool. I didn't know you could change your MAC address. Oh the possibilities.

  • dudu

    it doesn't work properly.
    if i change the mac address, I get “Connection Timeout” message everytime i try to join any connection.
    If i change back to the original MAC address it works good again.
    it's not useful, someone help me, please…

  • Robert

    No it does not work for most people, I would like to find the solution. Apparently Apple had removed the ability to change it in the update to snow leopard, it worked in Leopard… I like the GUI and many aspects of the apple OS X but if this is their standard, well I will then think on alternative solutions in unix and start buying regular pc's and just run unix off them.

  • andy111

    yep, same for me.
    doesnt work, get connection timeout.
    if i return mac to original, all good again….

  • Pingback: Tales of a Minnesota Geek » Blog Archive » links for 2010-02-28

  • alibaba80

    Don't seem to be able to change mac address in 10.6.2 Anyone with a fix?

  • gmcd2200

    Here is a ksh script to make a random mac addr. for Mac Osx 10.6x
    # Written by Graeme Mc Donough
    # Copy and manipulate this .. but give me credit. for the code thanks.
    # Version 1.0 16-04-2010
    # This script is called “rand_mac.ksh”
    # This script is free.. enjoy..
    # This script was written to work with Mac Osx 10.6
    # Mac OSX 10.6 ksh has a bug.. so I added a work around in the script.
    # Assumptions
    # * you have put in a link for the airport to /usr/sbin
    # * you will run this script with “sudo ./rand_mac.ksh”
    # * You will know how to use vi.. I am a unix person.. not a pico person.. so don't ask me
    # NOTES
    # * I found a way to make the Airport auto lock back on to your fav wireless
    # just un-comment the 3 bottom lines. Note.. it may make the script not work well”
    # Go figure /shrug

    /usr/sbin/airport -z

    GET_HEX ()
    if [[ ${VAR} -lt 10 ]]
    HEX_VALUE=`echo ${VAR}`

    if [[ ${VAR} -eq "10" ]]
    if [[ ${VAR} -eq "11" ]]
    if [[ ${VAR} -eq "12" ]]
    if [[ ${VAR} -eq "13" ]]
    if [[ ${VAR} -eq "14" ]]
    if [[ ${VAR} -eq "15" ]]

    # echo “${HEX_VALUE}”

    for i in {1..6}}




    FIX_I=`echo ${i} | awk -F} '{print $1}'`
    #echo $FIX_I
    if [ ${FIX_I} -eq 6 ]
    FULL_HEX=`echo ${FULL_HEX}${HEX_VALUE}:`


    echo “The new randomised Mac Addr = ${FULL_HEX}”
    echo “Attempting to change en0 to the New Mac Addr it does not work all the time.”
    echo ” the first thing we do is wait… aournd 20 seconds … boooring”
    sleep 25
    ifconfig en0 ether ${FULL_HEX}

    echo “The (hopefully changed to tbe the same) mac addr for en0 = ${VALUE}”
    echo “if not .. run this again.. .. it will eventually work”

    #ifconfig en0 down
    #sleep 3
    #ifconfig en0 up

  • 3n4b13r

    Ok i think i know what you did. I have 10.6.3 running on my macbook. Im not 100% sure but its an idea. I had to disassociate from all networks before changing my mac address. I tried turning my airport off and then i got “Device power is off” I then turned it on but DID NOT join a network and it worked fine. Here is the command i used:

    sudo ifconfig en1 lladdr 00:11:22:33:44:55

    I hope i helped. If not i'll try to look more into the problem with my friend's macbook pro.

  • http://www.easyrecovery.co.uk data recovery

    thank you so much for that solution! i knew it could be done i just couldn't figure out the proper syntax.

  • http://www.air-jordan-17.com air jordan 17

    It looks good,I have learn a recruit!
    Recently,I found an excellent online store, the “http://www.air-jordan-18.com are completely various, good quality and cheap price,it’s worth buying!

  • http://www.louis-vuitton-outlet-store.com louis vuitton on sale

    I like writing, hurriedly, not that you are not

  • http://www.louis-vuitton-outlet-store.com louis vuitton on sale

    I like writing, hurriedly, not that you are not

  • Mykebr

    Is there a way to save this?
    So I don't have to change it every time I restart the pc?

  • Skwidspawn

    You can use automator to create an easy script. Save the script as an application. Go to your System Preferences>Accounts>[Your Account]>”Login Items” tab>”+” sign>Select Your New Script App>Add>Restart Machine.
    Your computer will now run the script to set your mac address every time it reaches the desktop on startup.

  • Tom

    Expected end of line, etc. but found “/”. error

    highlights the / of the /usr/sbin/airport -z portion of code

    dunno much about scripting, but can you advise on how to make an apple script with this?

  • Gmcd2200

    Hi Tom

    This just means you do not have the airport command in its right location
    you can find it's location by putting this command (below) in the terminal.

    find / -name airport -print 2>/dev/null

    One of the responses will show you where the airport command will be.
    Also .. just a thought.. you are running a mac right ? if not I will have to write a different script to allow this to work.
    NOTE::This concept will work on any Unix computer.


  • Tom

    I am indeed running on a mac.

    I used “sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport” to make a link to airport, then just replaced the/usr/bin line with “sudo airport -z”. the end result says it changed the mac address, but it actually did not after running ifconfig to check.

    I guess what I am actually trying to do is create an automated way to randomize my mac address. Like using automator or make an applescript. though I am a newb when it comes to those.

  • Tom

    Allow me to clarify, because my last post seems unclear.

    I want to make an app or an executable script to run your script w/out going thru terminal. Like double click an icon on the desktop and away she goes. I understand that you need sudo to run “airport -z”, so is there a way around that?

  • Pingback: I have a question about using a router as a wireless client instead of its usual purpose? - Quick Questions & Quick Answers

  • Gmcd2200

    Hi Tom
    There is a way around that.
    assuming you don't mind it running at certain intervals.
    you can do a ==> man crontab.
    from there you can set-up the root user to run the command for you.
    Cron will allow all sorts of day's hours mins weeks and even years that this thing can be run.
    I use this method where the root's crontab runs my script 2 times per week.
    No clicking required. it all just happens.. nice to have a random spinning mac addr


  • Gmcd2200

    just to add to the above post. if you like.
    put up your e-mail and I will help you via e-mail with this method.
    to get it working

  • Backtrackuser

    It seems to work perfectly for en0 but not of an external USB WLAN card.
    on Snow Leapord

    1. vi /usr/local/machanger.sh
    2. Append the shell script above in this file (replace en0 to $1 to make it generic)
    3. Put your Airport Off
    4. /usr/local/macchanger.sh en0
    5. Connect to you desired AP
    6. ifconfig -a

    You should see the new MAC address.

  • Mac

    He's doing it wrong. After detaching with airport -z It's:
    sudo ifconfig en1 lladdr 00:11:22:33:44:55 etc
    Then use the menubar to reattach to your wireless network

  • feka

    Same here. Strange that nobody could get around this problem.

  • heirhair

    thanks a lot for sharing this to me…
    this is quite important and useful for me

  • qiuzhiaa

    If my router is not wireless, how can I change it? Thank you!