Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to enable internet sharing using command

Hi


I have to start internet sharing in my mac book remotely. Can any body help me in this. I can do this using gui and it working for me.


Any command ???

Suggestions ??


Thanks in advance,

Vishal

MacBook Pro, Mac OS X (10.6.7)

Posted on Jul 1, 2011 6:55 AM

Reply
6 replies

Jul 1, 2011 11:04 AM in response to vishal.wlan

Mac boxes make comparatively rotten IP routers. Awkward, potentially insecure, and difficult to manage. Get yourself a real IP router, preferably with VPN server capabilies, and remote operations and management will tend to get far easier. (There are both commercial and open-source options.)


As for your question, the easiest way is via VNC; open screen sharing, connect in, and off you go.


For the command line version, something akin to the following should get you where you want:


sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist


Google around for details of these commands and of the plist and alternatives, depending on your particular requirements. I've seen an AppleScript (somewhere) that tweaks this stuff, if you prefer that interface.

May 20, 2015 2:36 AM in response to MrHoffman

MrHoffman wrote:

...

For the command line version, something akin to the following should get you where you want:


sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist

...

I can't understand why this plist method keeps getting perpetuated all over the internet. It does not work.

Perhaps it did back on Snow Leopard, but it certainly doesn't on Mavericks.


The only way Internet Sharing can be turned on in Mavericks that I have found is through the GUI. I'm sure there is a way via the CLI, but if it exists it's unpublished.

May 20, 2015 3:18 AM in response to perkhouse

On Mavericks and Yosemite, I have aliased in my ~/.bashrc:


alias startweb='sudo apachectl start'

alias stopweb='sudo apachectl stop'

alias restartweb='sudo apachectl restart'


If typing sudo and a password each time gets tedious, then update the /etc/sudoers file (if you have permissions), and then one can simply drop sudo from the above aliases.


In /etc/sudoers (use sudo visudo):


username hostname = NOPASSWD: /usr/sbin/apachectl

How to enable internet sharing using command

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.