mac安装brew遇到的一些问题

@

  1. mac终端执行命令/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”,无法建立连接或连接超时错误,错误信息如下:
    curl: (28) Failed to connect to raw.githubusercontent.com port 443 after 75059 ms: Couldn’t connect to server
    fatal: unable to access ‘https://​​github​​.com/Homebrew/brew/’: Failed to connect to github.com port 443: Operation timed out
    Failed to connect to raw.githubusercontent.com port 443: Connection refused
    解决:
    1)浏览器访问​​https://www.ipaddress.com​​,进入如下页面
    在这里插入图片描述

2)页面下拉到如图位置,输入域名,点击搜索
在这里插入图片描述

浏览器滚动至接近最下方,利用终端ping搜索到的ip,要ping通
在这里插入图片描述

3)在/etc/hosts中添加ip映射,如果映射的ip不对,则会提示超时等连接错误信息
在这里插入图片描述

  1. 长时间卡在 Downloading Command Line Tools for Xcode
    解决:
    1)终端输入:xcode-select --install
    2)mac根据提示在接通电源的情况下安装xcode-select

  2. xcode-select: note: Command line tools are already installed. Use “Software Update” in System Settings or the softwareupdate command line interface to install updates
    解决:
    1)终端输入sudo xcode-select -p 查看xcode-select位置(默认在/Library/Developer/CommandLineTools)
    2)删除xcode-select:sudo rm -rf /Library/Developer/CommandLineTools
    3)重装xcode-select:xcode-select --install

  3. error: 835 bytes of body are still expected96 MiB | 46.00 KiB/s
    fetch-pack: unexpected disconnect while reading sideband packet
    fatal: early EOF
    fatal: fetch-pack: invalid index-pack output
    Failed during: /usr/bin/git fetch --force origin
    解决:
    终端输入:git config --global http.postBuffer 524288000
    此时仍提示错误:Error: Failed to download https://formulae.brew.sh/api/formula.jws.json!
    Failed during: /opt/homebrew/bin/brew update --force --quiet
    如果还出现错误,建议删除homebrew并重新安装

用国内镜像源:
删除:/bin/zsh -c "(curl−fsSL​​https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"​​安装:/bin/zsh−c"(curl -fsSL ​​https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"​​ 安装:/bin/zsh -c "(curlfsSL​​https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"​​安装:/bin/zshc"(curl -fsSL ​​https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"​​

以上创作全凭经历回忆,希望能够帮助到您。本人从事软件开发有5年多的时间了,现在真的好想自主创业,可没人脉没资源的自己难免产生着很多焦虑,这里希望同行的你能带给我一点鼓励,让我能在软件这行继续坚持下去。同时个人整理了一些主流平台的学习资源,需要者联系
在这里插入图片描述

### 安装 Homebrew 的步骤 HomebrewmacOS 下的一个软件包管理工具,能够帮助用户轻松安装、更新和管理各种命令行工具、开发库以及应用程序。以下是详细的安装步骤: 1. **打开终端** 在 macOS 上,可以通过以下方式打开终端: - 打开“Finder”,然后转到“应用程序” > “实用工具” > “终端”。 - 使用 Spotlight 搜索栏,输入“终端”,然后打开终端应用程序[^5]。 2. **运行安装命令** 在终端中粘贴以下命令以安装 Homebrew: ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` 此命令会下载并运行 Homebrew安装脚本。安装过程中可能会提示用户输入密码或确认操作,按照提示完成即可[^2]。 3. **验证安装** 安装完成后,可以运行以下命令来验证 Homebrew 是否成功安装: ```bash brew doctor ``` 如果输出显示 "Your system is ready to brew.",则表示安装成功[^4]。 4. **使用 Homebrew 安装软件** 成功安装 Homebrew 后,可以通过它来安装软件包。例如,安装 `wget` 可以使用以下命令: ```bash brew install wget ``` Homebrew 会自动处理依赖关系,并将软件包安装到合适的位置[^4]。 5. **更新与卸载** - 更新 Homebrew 和已安装的软件包: ```bash brew update && brew upgrade ``` - 卸载不再需要的软件包: ```bash brew uninstall <package-name> ``` ### 注意事项 - **网络连接**:安装过程中需要稳定的互联网连接,因为 Homebrew 会从远程仓库下载软件包。 - **权限问题**:如果遇到权限错误,可以尝试在命令前加上 `sudo` 来提升权限。 - **自定义配置**:Homebrew 允许用户通过配置文件(如 `.zshrc` 或 `.bash_profile`)调整环境变量或添加别名。 - **社区支持**:如果在安装或使用过程中遇到问题,可以查阅 [Homebrew 的官方文档](https://docs.brew.sh/) 或寻求社区的帮助[^3]。 ### 示例:使用 Homebrew 安装 Docker Docker 是一个流行的容器化平台,可以通过 Homebrew 快速安装。以下是具体步骤: 1. 安装 Docker: ```bash brew install docker ``` 2. 启动 Docker 服务: ```bash brew services start docker ``` 3. 验证 Docker 是否正常运行: ```bash docker --version ``` ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值