I’ve been having trouble with IPv6 on my El Capitan Mac over T-Mobile’s network. I have been using T-Mobile Home Internet for a couple months. On my El Capitan Mac, I was noticing slowness or connectivity issues sometimes, including with composer. When I couldn’t get composer to work at all, giving an “failed to open stream: Operation timed out” message, I decided to look into it. I found that any PHP call to an external URL with file_get_contents() or the like gave the same error, eg:

$ php -r 'echo file_get_contents("http://macn.me");'
PHP Warning: file_get_contents(http://macn.me): failed to open stream: Operation timed out in Command line code on line 1

I found composer’s docs on the issue, which told me to run networksetup -setv6off Wi-Fi, disabling IPv6 on the network interface entirely. That worked and also seemed to fix some slowness issues I was experiencing elsewhere.

Reverting the change can be done with: networksetup -setv6automatic Wi-Fi.

My High Sierra Mac isn’t getting an IPv6 address from the router either, but it isn’t having connectivity issues like the El Capitan Mac. I’ve left its network interface alone.

I’m not sure if this is a T-Mobile issue or old Mac issue or what. I saw some people mentioning problems with IPv6 on iOS because of some standard Apple hadn’t implemented, but I don’t know if that issue exists on Mac OS as well.