Turn off IPv6 on mac

First list interfaces:

$ networksetup -listallnetworkservices
An asterisk (*) denotes that a network service is disabled.
Thunderbolt Ethernet
Wi-Fi
Bluetooth PAN
Thunderbolt Bridge

Next:

$ networksetup -setv6off "Thunderbolt Ethernet"

For Wi-Fi:

$ networksetup -setv6off  Wi-Fi