Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a small shell script to spoof my wireless interface mac address. I'd like to run this script on my mac (snow leopard) before the airport utility starts and attempts to connect to an access point. Where would I put this script or what appropriate startup file is referenced where I can have it call my spoofing script?

Here's my little bash script:

$ cat 

#bring en1 down
sudo ifconfig en1 down;
#generate random mac address
MAC=`/usr/bin/openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`;
#change mac address with ifconfig
sudo ifconfig en1 ether $MAC;
#bring en1 up
sudo ifconfig en1 up;
share|improve this question

migrated from Oct 20 '11 at 11:52

This question came from our site for system and network administrators.

how about run a script on shutdown to turn the airport off. Then when you start up the system again airport will be off and just turn the airport on at the end of the script?

/usr/sbin/networksetup -setairportpower en1 off
share|improve this answer

I don't know if it's possible, but you could try to create a script to change the MAC address and then, turn airport on (maybe using this

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.