Software⏱️ 2 min read📅 2026-05-30

How to Fix: Gemini CLI crashes with TypeError: fetch failed from undici on macOS

Gemini CLI crashes with TypeError: fetch failed from undici on macOS, likely due to a misconfigured or outdated version of the Gemini CLI.

Quick Answer: Try updating the Gemini CLI to the latest version and ensure that undici is installed and up-to-date.

The Gemini CLI crash on macOS is often caused by a misconfiguration of the undici library, which is used for HTTP requests. To resolve this issue, try updating undici to the latest version using Homebrew or pip. You can also try disabling the MCP servers that are causing the error and see if it resolves the issue.

🔧 Proven Troubleshooting Steps

Method 1: Update undici using Homebrew

  1. Step 1: Run the command `brew upgrade undici` in your terminal to update to the latest version.

Method 2: Update undici using pip

  1. Step 1: Run the command `pip install --upgrade undici` in your terminal to update to the latest version.

Method 3: Disable MCP servers

  1. Step 1: Run the command `gem config set MCP_SERVERS ` in your terminal to disable all MCP servers.

💡 Conclusion

By following these steps, you should be able to resolve the Gemini CLI crash on macOS and get back to using your chatbot.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions