Fixing Snow Leopard’s Wireless Dropping Issue

by Jason on April 4, 2010

Ever since upgrading to Snow Leopard I’ve had major issues with my wireless connectivity. I recently hooked up an old Mac Mini to my TV for the sole purpose of running Boxee and these wireless issues have plagued me.

I tried all of the “fixes” mentioned on forum posts including:

  1. Manually setting IP address & DNS in Network Settings
  2. Flushing DNS
  3. Restarting Airport (doesn’t help if you can’t connect in the first place)
  4. Resetting PRAM

All of the solutions would temporarily fix the problem but usually within 10 minutes the connection would drop again.

So, my solution was to write a simple bash script that checked for network connectivity and if none existed it would flush the DNS and restart the airport.

Simply place this script on your system and create a cron job to execute the script every minute.


count=$(ping -c 1 '' | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
if [ $count -eq 0 ]; then
	#no internet 
	#make sure connectivity isn't currently being restarted
        if [ ! -f /Users/[insert_your_user_here]/ ]; then

                #create pid file so script doesn't continuously run
                #when being restarted
                echo "Creating PID"
                touch /Users/[insert_your_user_here]/;

                #log event
                echo "No Internet " `date` >> /Users/[insert_your_user_here]/network_monitor.log;

                #flush DNS
                echo "Flushing DNS"
                dscacheutil -flushcache;

                #restart airport
                echo "Restarting Airport"
                /usr/sbin/networksetup -setairportpower en1 on;

                #sleep for five seconds
                echo "Sleeping"
                sleep 5;

                #clear pid file
                echo "Clearing PID"
                rm -f /Users/[insert_your_user_here]/;
	#internet is good
	echo "Internet Live " `date` >> /Users/[insert_your_user_here]/network_monitor.log;