How to completely disable IPV6 on Mac OS X (10.5 +)

ipv6mac-osxnetworking

I'd like to avoid my Mac OS X machine from using ipv6 at all.

I'm looking for a programmatic way to disable ipv6 on every network interface and, possibly, to avoid ipv6 support by the kernel at all.

As an explanation, I need the equivalent of adding "alias ipv6 off" to modprobe.conf in linux.

The "it's impossible" answer is welcome, being supported by some kind of official source, of course.

EDIT:

I want to remove ipv6 from logs, from ipfw, from everywhere. Even for the satisfaction of knowing if and how it is possible. It is is right to do it is another issue 🙂

Best Answer

You can disable IP6 for a specific device with

networksetup -setv6off Service name
(i.e  networksetup -setv6off "Ethernet 1")

and get the list of all possible services with

networksetup -listallnetworkservices

See man networksetup for more info.

I don't know if you can tell networksetup to perform the command for every interface at once, but it shouldn't be too hard to write a short script that iterates over the output of the list command and disable IP6 on all devices.