Geek Posted May 31, 2011 Posted May 31, 2011 <div class="KonaBody"><p><img src="http://osxdaily.com/wp-content/uploads/2011/05/airport-icon.jpg" alt="AirPort Wireless icon" title="airport-icon" width="150" height="150" class="alignright size-full wp-image-16611" /> Sometimes the easiest fix when <a href="http://osxdaily.com/2009/12/22/mac-wireless-problems-guide-to-troubleshooting-airport-wireless-problems-on-your-mac/">troubleshooting an AirPort wireless connection problem</a> is to just turn AirPort on and off. Instead of using the menu item or System Preferences, we can enable and disable AirPort very quickly directly from the Mac OS X Terminal. </p> <p><strong>Turn Airport Off via Command Line</strong> <code>networksetup -setairportpower airport off</code></p> <p><strong>Turn Airport On via Command Line</strong> <code>networksetup -setairportpower airport on</code></p> <p>You won’t see any confirmation in the Terminal that the command succeeded or failed, but if you watch the AirPort menu icon you will see the bars disappear indicating the wireless interface is turned off, or reappear indicating that wireless is activated again. </p> <p>We can also string the commands one after the other to power cycle the wireless interface on a Mac:</p> <p><strong>Quickly Power Cycle AirPort with Mac OS X’s networksetup Tool</strong> <code style="font-size:90%;">networksetup -setairportpower airport off; networksetup -setairportpower airport on</code></p> <p>The AirPort wireless card seems to respond faster to the command line networksetup tool than any other method, making this an ultrafast method of power cycling the wireless interface. This is often enough to resolves basic wireless router connectivity issues like <a href="http://osxdaily.com/2010/09/19/another-device-on-the-network-is-using-your-computers-ip-address/">IP conflicts</a> or malfunctioning DHCP requests. </p> <p>I have enough regular encounters with one particularly flakey router that I created an alias to power cycle my AirPort card, you can do this by adding the following to your .bash_profile just be sure it is on one line:</p> <p><code style="font-size:80%;">alias airportcycle='networksetup -setairportpower airport off; networksetup -setairportpower airport on'</code></p> <p>Now like any other alias, you only type ‘airportcycle’ and the wireless interface will immediately turn itself off and on again.</p> <p>Disabling and reenabling AirPort is not the same as <a href="http://osxdaily.com/2011/04/12/connect-wireless-network-command-line/">connecting to a wireless network from the command line, although you can do that too</a> also by using the networksetup tool.</p> </div> <p><a href="http://feedads.g.doubleclick.net/~a/JWThn5_uOKB-uAC2N-nuMhSl5Lc/0/da"><img src="http://feedads.g.doubleclick.net/~a/JWThn5_uOKB-uAC2N-nuMhSl5Lc/0/di" border="0" ismap="true"></img></a><br/> <a href="http://feedads.g.doubleclick.net/~a/JWThn5_uOKB-uAC2N-nuMhSl5Lc/1/da"><img src="http://feedads.g.doubleclick.net/~a/JWThn5_uOKB-uAC2N-nuMhSl5Lc/1/di" border="0" ismap="true"></img></a></p><div class="feedflare"> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=kJ2ZJTfEIbo:oJpl-UiLWtk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=kJ2ZJTfEIbo:oJpl-UiLWtk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=kJ2ZJTfEIbo:oJpl-UiLWtk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=kJ2ZJTfEIbo:oJpl-UiLWtk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=kJ2ZJTfEIbo:oJpl-UiLWtk:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=kJ2ZJTfEIbo:oJpl-UiLWtk:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=kJ2ZJTfEIbo:oJpl-UiLWtk:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a> </div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/kJ2ZJTfEIbo" height="1" width="1"/> View the full article
Recommended Posts