How can I enable Internet sharing without using the GUI or AppleScript? for some rather strange reason my sharing preferences tab crashes (it's a long story and there seems to be no good solution for it, it's looking for a ui object that no longer exists).

Anyway, I want to enable internet sharing to share my macbook's internet connection with my iPad but I can't find a way to do it without the gui or apple script (which basically calls the gui). 

The problem is I need to both (1) set up and (2) run the internet sharing daemon. Running the daemon is easy but I can't configure it.

So far I am thinking I need to 1- enable routing 2- run natd 3- make sure firewall is properly configured 4- make a peer to peer wireless network on wifi.
Another option is to use sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist the problem is I need at least a valid Snow Leopard .plist file for this to work.

Another solution I tried is to use a virtual machine (I use an Ubuntu VM in Parallels) to do the connection sharing. It works but it's too much work.

(In case you are wondering, when I click on shring in the preferences tab it crashes and in console I get an error like "unknown Class 'AppleSharing_NatManager' using 'NSObject' instead")

Any comments?
The plist that others have mentioned (/System/Library/LaunchDaemons/com.apple.InternetSharing.plist) never seems to change regardless of the state of Internet Sharing -- at least under Snow Leopard.

I think the answer lies somewhere in /usr/libexec/InternetSharing and /etc/boopd.plist.

First, try running:

sudo /usr/libexec/InternetSharing -d

You will probably see messages like the following:

InternetSharing[40307]: InternetSharing starting

/etc/bootpd.plist is empty/missing

InternetSharing[40307]: no primary service specified, exiting

It turns out that /etc/bootpd.plist is created when Internet Sharing is started from the Sharing pref pane, and it is deleted when Internet Sharing is turned off.

If you are feeling adventurous, you could try manually creating the plist file.  I enabled Internet Sharing with Ethernet shared to AirPort and copied the text of the resulting /etc/bootpd.plist file to a pastebin here: http://pastebin.com/gQVzARfa

This plist doesn't contain all the necessary settings (e.g. SSID for the wireless shared connection), so I'm guessing it won't work on its own.  I'm still looking for the other settings and will update this answer if I find them.  (It's possible some are passed in as parameters to /usr/libexec/InternetSharing, but I can't find any documentation on that.)

Once you have created the plist file, try running sudo /usr/libexec/InternetSharing -d again.  We may be able to work through this one error at a time.  At this point it's really an academic exercise, as it would be far easier to reinstall your OS to fix your pref pane issue.  ;]

If by some miracle it does start, I believe /usr/libexec/InternetSharing -q will stop sharing.

Messing with your system files is always somewhat risky, so make sure you have a recent backup of your important files (I recommend Dropbox).