Is it possible to configure Internet Sharing to allow the computer to sleep? TL;DR: Internet Sharing is preventing my Mac from sleeping. I need to manually sleep the system on a regular basis. I want a way to configure Internet Sharing to stop preventing sleep.


I have an iMac at home in my bedroom too far away from my router, and I can't use wireless, also, 3G coverage here is awful, so I've enabled Internet Sharing so I can use my iPhone/iPad connected trough my iMac.

At work I am on a corporate network and wireless is somewhat lame and too restrictive, so I've enabled Internet Sharing on my MacBook Pro there too, so my iPhone can reach internal stuff.

The problem is: When I hit ⌘+⌥+⏏ (or  > Sleep) neither computer goes to sleep as desired; that is unless I disable Internet Sharing first.

At home I want the computer to sleep while I sleep (saves power + more silence) and at work when going home I want it to sleep too, so I don't have to close all connected apps (Adium, Colloquy, etc) and reopen again the next day.

How can I configure pmset or Internet Sharing so I can sleep my computer without running into this problem?

Note: I've already used pmset to check if there were other reasons and the offending pid is always com.apple.InternetSharing.

Edit: I realize that sleeping the computer will make it impossible to use Internet Sharing. I want it to sleep completely and I want Internet Sharing to be on again only when the computer awakes.
I have experimented with using ControlPlane to achieve what you want.  My preliminary result is that it will do what you want.

ControlPlane detects changes to your system called 'evidence sources'.  Changes are evaluated with 'rules' which define a change in 'context'.  Associated with each context are 'actions'.

One of the 'evidence sources' is a sleep/wake event.  So I have configured a rule so that on a sleep event (e.g. you have clicked sleep in the Apple menu), the context 'Sleepy Time' is triggered.  And for this context I have used the action 'ToggleInternetSharing' to off.

After clicking on Sleep, I get an alert saying that Internet Sharing is being turned off and after a little while (seems like forever but is probably only 10 or 20 seconds) the Mac goes to sleep.

And I have a second rule so that on a wake event the context 'Waking Up' is triggered and this has the action to set 'ToggleInternetSharing' on.

My Rules and Actions:




Try it!

This is just scratching the surface of what ControlPlane can do.