Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to get my Mac to latch onto my friends wifi signal and use Internet Sharing to share it with my other non-wireless desktop, but I'm running into a problem: Apple Internet Sharing doesn't stay enabled.

I enable wireless networking and connect to my friends network on my Mac Mini, enable Internet Sharing on the same machine, and go to my other computer to start using the internet, but when I get to my other machine I find it has no internet. Going back to the Mac Mini shows that Internet Sharing has been disabled. This is most frustrating, I'm not the only one who uses the non-wireless machine but I am the most tech savvy and as such I'm expected to make sure the network works properly. I need Internet Sharing to stay enabled so that when I go to work, my room mate can continue using the internet.

How can I set Apple's Internet Sharing to stay on permanently?

PS, I suspect that Internet Sharing is disabling itself when the Mac Mini temporarily loses connectivity with my friends wireless network, but I don't understand why it doesn't (and why there is no setting for) automatically re-enabling it when reconnecting to the same wireless network.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I never did find a way of making Internet Sharing stay on, but I did come up with a way of achieving the same result. With a quick bit of Ruby, I whipped up this solution.

Load IRB by opening terminal and typing irb

Copy and paste this into irb, and hit Enter to activate.

 while(true);sleep 15;puts Time.now.to_s + ": " + `launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist 2>&1`;end

As it stands, the code will re-activate Internet Sharing every 15 seconds. Now, that may seem like too short of a period, but at 15 seconds there's a good chance that the connection will be re-enabled before any connection drops occur. You can change 15 to any number of seconds that you like.

This will result in a log such as:

Mon Jul 25 09:37:07 -0400 2011: com.apple.InternetSharing: Already loaded
Mon Jul 25 09:37:22 -0400 2011: com.apple.InternetSharing: Already loaded
Mon Jul 25 09:37:37 -0400 2011: com.apple.InternetSharing: Already loaded

It's important to remember that closing the window will terminate the script (Internet Sharing won't re-activate every 15 seconds), so if you need to close the window, consider using screen which is included on Macs.

share|improve this answer
    
Isn't the boolean value KeepAlive in /System/Library/LaunchDaemons/com.apple.InternetSharing.plist done to provide this exact function? –  daniel Azuelos Jul 28 '12 at 23:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.