Skip to content

Instantly share code, notes, and snippets.

@zulhfreelancer
Last active October 30, 2023 05:34
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zulhfreelancer/e8eb723e97a818b6727fb53bd94a0a96 to your computer and use it in GitHub Desktop.
Save zulhfreelancer/e8eb723e97a818b6727fb53bd94a0a96 to your computer and use it in GitHub Desktop.
How to fix bundle install 'network error while fetching' issue on Mac OSX?

If you get something like this when running bundle install...

Network error while fetching https://rubygems.org/quick/Marshal.4.8/xxx-x.x.x.gemspec.rz (execution expired)

...this solution might work for you.

First, make sure you have tried all the troubleshoot solutions here.

Next, please also make sure you are using the latest cacert.pem file. You can download it from here. In my case, I saved it at /usr/local/etc/openssl/certs/cacert.pem.

If it's still doesn't work, you can try disabling IPv6 in your Mac.

$ networksetup -setv6off Wi-Fi

Result:

Of course, if you need the IPv6 again, run the following command:

$ networksetup -setv6automatic Wi-Fi

Result:

In my case, the bundle install command worked after I disabled IPv6. Strange, right?

Tweet me if this solution works for you!

@Stankovskij
Copy link

$ networksetup -setv6off Wi-Fi worked for me. Thanks!

@called2voyage
Copy link

Using Ubuntu 20.04 and disabling IPv6 worked for me too.

@aniketacima
Copy link

For Ubuntu to disable ipv6

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment