Sign up ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

2 Answers 2

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.