Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Muggsy

macrumors newbie
Original poster
Feb 8, 2013
19
0
Hi everyone

Do you know how to disable the wifi automatically when shutting down the computer (10.8.2)?
I have been searching the internet but all I could find was people having problems with this.

Thanks a lot
:):):):):)
 
Why is that necessary? If you shut down your computer, the WiFi on your Mac is disabled like everything else.

Or do you mean something different, like disabling your router's WiFi? If so, how should the router know, that you are available again once you start the Mac anew?
 
Hi

Sorry it made sense to me, I should have been clearer.
Basically what I want is to have the wifi OFF when I switch on the computer, whatever status it had when I previously switched the computer off.

Do you think it is possible?
:):):):):)
 
Hi everyone

Do you know how to disable the wifi automatically when shutting down the computer (10.8.2)?
I have been searching the internet but all I could find was people having problems with this.

Thanks a lot
:):):):):)

This should work. Open Applescript Editor and paste in the text below. Then hit command-s and save the script as an application named whatever you want.

You can drag the application into the Dock if you like. When you launch the application it will turn off wifi and shutdown the machine.

Code:
do shell script "networksetup -setairportpower en0  Off"
delay 1
tell application "Finder"
	shut down
end tell
 
Code:
do shell script "networksetup -setairportpower en0  Off"
delay 1
tell application "Finder"
	shut down
end tell

A. I'm pretty sure it needs to be en1 rather than en0, though it may depend on the Mac model. I.e. en1 is wifi on Macs with both ethernet and wifi. I don't know what a MacBook Air has for its wifi interface name, since it doesn't ship with ethernet by default.

B. If just the do shell script line is placed in an AppleScript application, then that app can be added to a user's Login Items, and will run at login. I mention this because it's easier to add things to run at login than it is to add things to run at shutdown or logout.
 
Hi guys

I was thinking about that option as well if no built in option already existed, as I always use the shortcut to shut the computer down.
I guess I could also replace that shortcut and make it open the dedicated application with Quicksilver instead, but it would get complicated as a confirmation option would be ideal. If anybody wants to go for a code for that please don't hesitate to put it :)

Anyway going back to the Start option, what you basically recommend is to simply open Applescript Editor and insert:
Code:
[I]do shell script "networksetup -setairportpower en0  Off"[/I]

Then save the script as an application and paste it in the Login Items.

Is that right?
Thanks!
:):):):):)
 
A. I'm pretty sure it needs to be en1 rather than en0, though it may depend on the Mac model. I.e. en1 is wifi on Macs with both ethernet and wifi. I don't know what a MacBook Air has for its wifi interface name, since it doesn't ship with ethernet by default.

B. If just the do shell script line is placed in an AppleScript application, then that app can be added to a user's Login Items, and will run at login. I mention this because it's easier to add things to run at login than it is to add things to run at shutdown or logout.

A. Nope. Before posting this I tested it on my 2012 MBA and it works with en0.

B. That would leave wifi on at shutdown and it would turn it off shortly after login... yes. I'm not sure if that is what OP is trying to accomplish though.
 
Thanks that has solved my problem.
It wasn't what I was thinking of originally but it did the trick.
I just needed indeed to change the en0 into an en1 (I'm on a MacBookPro).

If anybody wants to add a code for a confirmation of shutdown question to be added to the shutdown+wifiOFF app, it may help someone in the future.

Thanks again!
:):):):)
 
Thanks that has solved my problem.
It wasn't what I was thinking of originally but it did the trick.
I just needed indeed to change the en0 into an en1 (I'm on a MacBookPro).

If anybody wants to add a code for a confirmation of shutdown question to be added to the shutdown+wifiOFF app, it may help someone in the future.

Thanks again!
:):):):)

This will give you a popup with okay/cancel.

Code:
display dialog "Are you sure you want to shut down?"
do shell script "networksetup -setairportpower en1  Off"
delay 1
tell application "Finder"
	shut down
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.