Fix wi-fi dropping osxlion


Mac Wi-Fi Dropping? Use a Simple Keepalive Bash Script to Maintain Wireless Connection

Command Line, Mac OS X, Tips & Tricks, Troubleshooting – August 8th, 2011 – 3 Comments

Mac Wi-Fi Keepalive Script

Many users who upgraded to Mac OS X Lion discovered that their Wi-Fi connections were dropping periodically for no apparent reason. We published a reasonably thoroughwalkthrough with tips on fixing OS X Lion’s wireless dropping issues and that’s a recommended starting point because most tips are easy and less complicated, but among those was a trick to maintain data transfer by pinging an IP address.

The keepalive ping technique seems to work, but it turns out you don’t need to ping an external IP, you can also justoccasionally ping your local wifi access point. With this in mind, we’re going to create a simple keepalive script that will run from the command line and ping your router every 5 seconds, allowing the wifi connection to maintain itself and prevent a drop.

1) Get your WiFi Router IP Address

You’ll need to know your wireless access points IP address before proceeding, it’s usually something like or

You can get this information from System Preferences > Network > Advanced > TCP/IP and looking for the IP next to “Router”:

Get WiFi Router IP Address in Mac OS X

Make note of that IP and proceed with the following:

2) Create the Keepalive Bash Script

  • Launch the Terminal (located in /Applications/Utilities/)
  • Type the following command:


Paste in the following, be sure to replace the IP with your own routers: #!/bin/bash
ping -i 5 -n

Hit Control+O to Save the contents of Hit Control+X to exit from nano

3) Run the Wi-Fi Keepalive Bash Script

  • Back at the command line, we have to make the script executable, we do this with:

chmod +x

Now to run the keepalive script, we type: ./ &

That last command starts and runs the script in the background. Your wireless connection should stay alive now and dropping should come to an end.

The idea of creating a simple bash script comes from Ahmet C. Toker, who left the trick in our comments and said that after he ran it “the problem melted away” and the wifi stopped dropping. It’s less of a fix and more of a simple workaround, but it does seem to maintain wifi connections, and it’s probably better than pinging an external IP address like for a number of reasons.

The remaining question is if there is a bug with how Mac OS X 10.7 handles wifi connections, or if some routers just don’t play well with OS X. I think it’s the latter, because I’ve only encountered the problem on select brands of routers and others are flawless, but for all routers I have found a solution that stopped the connection failures completely. It’s possible that a future update to OS X 10.7 will resolve the issue completely for everyone.


Informazioni su Davide

age 45, buddhist philosphy.

Pubblicato il 08/08/2011, in Guide con tag , . Aggiungi il permalink ai segnalibri. Lascia un commento.


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:


Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )


Connessione a %s...

%d blogger hanno fatto clic su Mi Piace per questo: