You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac OS Big Sur安装csvkit遇404及openssl链接错误求助

问题与解决方法

问题背景

在Mac OS 11.7.7上执行brew install csvkit时触发404错误,无法下载https://formulae.brew.sh/api/cask.jws.json;使用官方脚本升级Homebrew时也出现相同404错误。

使用brew config查看的配置信息如下:

$ brew config
HOMEBREW_VERSION: 4.0.24-19-g1c081f3
ORIGIN: https://github.com/Homebrew/brew
HEAD: 1c081f379dcaa2e8e6eb055edc49fe2e0457862b
Last commit: 7 days ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: a3e0fb3fe4a28d59c4f0fc68198e3aab24a12be8
Core tap last commit: 4 months ago
Core tap branch: HEAD
Core tap JSON: 21 Jun 21:01 UTC
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.UU9eGSZiOw/org.macosforge.xquartz:0
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.10 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.10_1/bin/ruby
CPU: octa-core 64-bit haswell
Clang: 12.0.5 build 1205
Git: 2.39.2 => /usr/local/bin/git
Curl: 7.87.0 => /usr/bin/curl
macOS: 11.7.7-x86_64
CLT: 12.5.0.22.9
Xcode: N/A

尝试HOMEBREW_NO_INSTALL_FROM_API=1 brew install csvkit后,Homebrew成功更新,但安装openssl@3时出现链接错误:

Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Directory not empty @ dir_s_rmdir - /usr/local/opt/openssl
Error: Directory not empty @ dir_s_rmdir - /usr/local/opt/openssl

解决步骤

1. 修复404错误

禁用Homebrew的API安装模式,让Homebrew从本地tap仓库获取公式信息:

  • 临时生效:每次执行命令前加前缀
    HOMEBREW_NO_INSTALL_FROM_API=1 brew [command]
    
  • 持久生效(根据你的shell类型选择):
    # Zsh用户
    echo 'export HOMEBREW_NO_INSTALL_FROM_API=1' >> ~/.zshrc
    source ~/.zshrc
    
    # Bash用户
    echo 'export HOMEBREW_NO_INSTALL_FROM_API=1' >> ~/.bash_profile
    source ~/.bash_profile
    

2. 修复openssl@3链接错误

  1. 检查残留目录内容:
    ls -la /usr/local/opt/openssl
    
  2. 备份并删除非空目录:
    mv /usr/local/opt/openssl /usr/local/opt/openssl_old
    
  3. 重新链接openssl@3:
    brew link openssl@3
    
  4. 如果链接失败,强制重新安装并链接:
    brew reinstall --force openssl@3
    brew link --force openssl@3
    
  5. 重新安装csvkit:
    brew install csvkit
    

3. 后续建议

系统中有174个过时公式和3个过时cask,建议逐步升级避免依赖冲突:

brew upgrade

内容的提问来源于stack exchange,提问作者Dave

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.18 06:07:00