During installation of new dependencies using composer, if you are getting this error “https://packagist.org/packages.json” file could not be downloaded: failed to open stream: Operation timed out" here is what you have to do.
The problem could be that Mac OS is forcing IPV6 IP addresses and looks like packagist.org does not like that. So the workaround for this is to disable IPV6 force on your Mac. Here is how you can do it.
Open terminal and execute this command
The problem could be that Mac OS is forcing IPV6 IP addresses and looks like packagist.org does not like that. So the workaround for this is to disable IPV6 force on your Mac. Here is how you can do it.
Open terminal and execute this command
networksetup -listallnetworkservices
you will get the list of network services, find your Wi-Fi from the list and stop IPV6 for it:
networksetup -setv6off Wi-Fi
after that you can run composer require your/package-name and it now it should work.
If you want to enable IPV6 again, execute this command
If you want to enable IPV6 again, execute this command
networksetup -setv6automatic Wi-Fi