mac brew 国内源配置
and run
/opt/homebrew/opt/openssl@3/bin/c_rehash
If you need to have openssl@3 first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openssl@3/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@3 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
For pkg-config to find openssl@3 you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
alias vcpkg="/Users/icezhang/Desktop/vcpkg-master/vcpkg"
alias python="/usr/local/bin/python3"
alias idf='. $HOME/esp/esp-idf/export.sh'
一、自动脚本(全部国内地址)(在终端中复制粘贴回车下面脚本)
苹果电脑 常规安装脚本(推荐 完全体 几分钟安装完成):
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
苹果电脑 极速安装脚本(精简版 几秒钟安装完成):
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" speed
苹果电脑 卸载脚本:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
Linux电脑 安装脚本:
rm Homebrew.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh ; bash Homebrew.sh
Linux电脑 卸载脚本:
rm HomebrewUninstall.sh ; wget https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh ; bash HomebrewUninstall.sh
成功的话,如上图所示。
二、常见错误说明:
Mac 10.11系统版本以下的(包括10.11),brew官方已经停止对这类老系统的支持。
1、first run: git -C xxxxxxx 等类似语句。
有可能废纸篓有之前自己删除的brew文件夹,清空一下。
如果还有这种提示,把报错中提供的解决语句(git -C ....)逐句运行一般就可以解决。
2、如果遇到报错中含有errno 54 / 443 / 的问题:
这种一般切换源以后没有问题,因为都是公益服务器,不稳定性很大。
3、检测到你不是最新系统,需要自动升级Ruby后失败的:
rm -rf /Users/$(whoami)/Library/Caches/Homebrew/
brew -v
如果还失败运行下面文章的脚本。
金牛肖马:如何升级Mac os自带的Ruby和Gemzhuanlan.zhihu.com
4、如果报错 command not found : brew
先运行下面命令看是否能出来Homebrew的版本号(结果看倒数3句)
/usr/local/Homebrew/bin/brew -v
再运行设置临时PATH的代码:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
brew -v
如果能用就是电脑PATH配置问题,重启终端运行echo $PATH打印出来自己分析一下。
5、如果brew -v没有报错 , brew update出错的:
这种不影响使用,尝试再次运行brew update可能赶上服务器不稳定的一瞬间。
6、brew有一个自检程序,如果有问题自检试试:
/usr/local/bin/brew doctor
提示http://github.com的地址问题不用在意,因为换成国内地址了,所以警告⚠️
7、Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
原因是执行过su命令,把账户切换到了root权限,退出root权限即可。
一般关闭终端重新打开即可,或者输入命令exit回车 或者su - 用户名
8、/usr/local/bin/brew: bad interpreter: /bin/bash^M: no such file or directory
git config --global core.autocrlf
如果显示true那就运行下面这句话可以解决:
git config --global core.autocrlf input
运行完成后,需要重新运行安装脚本。
9、from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
brew update-reset
10、M1芯片电脑运行which brew如果显示/usr/local/Homebrew/bin/brew
解决方法,运行卸载程序把之前的卸载掉或者手动删除/usr/local目录:
arch -x86_64 /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
编辑于 03-03
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH, run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"
更多推荐
所有评论(0)