一、brew的安装
cd /usr/local/Homebrew/Library/Taps/
mkdir homebrew
cd homebrew
git clone https://mirrors.ustc.edu.cn/homebrew-core.git
二、brew使用中遇到的问题 报错1:直接执行brew命令提示command not found
MACs-MacBook-Pro:bin mac$ brew
-bash: brew: command not found
解决办法:建立软连接
1、全局查找brew文件
find / -iname brew > test
2、 从其中找出非软连接的brew文件,建立软连接
sudo ln -s /Users/mac/xxx/usr/local/Homebrew/Homebrew/bin/brew /usr/local/bin/brew
3、刷新环境变量
sudo vim /etc/profile
export PATH=$PATH:/usr/local/bin # 添加该内容至/etc/profile文件
source /etc/profile # 配置修改生效
报错2:brew命令执行提示ln: current/2.6.8: Permission denied
解决办法:修改目录权限
sudo chown -R $(whoami) usr/local
执行报错:chown: /usr/local: Operation not permitted
关闭rootless,重启macOS按住command+R,进入实用工具-终端,执行以下命令:
csrutil disable
reboot
普通用户再次修改目录权限成功
MACs-MacBook-Pro:Desktop mac$ sudo chown -R $(whoami) /usr/local
Password:
MACs-MacBook-Pro:Desktop mac$
sudo chown -R $(whoami) /Users/mac/Desktop/Old_Homebrew
报错3:mac使用brew update更新无反应
http://t.zoukankan.com/sweetXiaoma-p-14337394.html
报错4:brew update 报错 “fatal: Could not resolve HEAD to a revision”解决办法:https://www.jianshu.com/p/b2de788c3c6d
三、brew安装软件
brew search python
brew install python3
验证python命令安装完成
MACs-MacBook-Pro:~ mac$ python3
Python 3.9.12 (main, Apr 10 2022, 12:20:43)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)