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 :)
You can disable IP6 for a specific device with
and get the list of all possible services with
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.
As already mentioned by neoice the 'ip6' tool is useful here. This allows you to disable IPv6 per interface, or 'ip6 -x' disables all but the loopback interface.
You can disable IPv6 on the loopback interface with
When I tried this though, DNS resolution stopped working.
So: Yes you can completely disable IPv6, but you'll get a seriously impaired system.
This will disable ipv6 on all network adapters:
In reply to your comment on SvenW's answer:
While IPv6 isn't used everywhere yet, it will be - maybe after a few years. So I'm guessing, and it would make sense, that IPv6 is as integrated to OS X as IPv4 was, and you would need to rebuild the kernel (and probably some applications) to remove any of them. (I don't have any sources though.)
this page looks informative. it looks like it does work if run as root. I dont feel like disabling it permanently, so I cant confirm the sysctl command.
it looks like ipv6 stays enabled on the loopback device though...
You said ipfw takes ipv6 rules. So you can simply block ipv6 there, this happens in kernel and nothing ipv6-related will work.