To Disable IPv6 on OS X from command line. It’s very easy, OS X has a command called
networksetup.With this command you can disable IPv6 for a specific device by typing into Terminal.app:
networksetup -setv6off Service name.
For example, if you wanted to disable IPv6 for ethernet, it would be:
networksetup -setv6off "Ethernet" or for Wireless it would be
networksetup -setv6off "Wi-Fi". To list all network devices the command is
The script below simply goes one by one device and turns it off, by applying the correct command:
To run the script, copy and paste it on your favorite editor (like text wrangler) and save it to your desktop as ipv6-off.sh then open terminal and go to
cd /users/username/desktopand type
chmod a+x ipv6-off.sh to make the script executable. To call the script simply type
After you authenticate, the script will list all the devices you have and will turn off IPv6 on each one of them. This script was tested successfully on High Sierra 10.13.4 and older.