Mac/HomeBrew的常见问题
Homebrew
基本命令#
安装
/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/HomebrewUninstall.sh)"
版本更新
brew update-reset
版本信息
brew -v
有图形界面的软件安装
brew install --cask 软件名
软件名查询
brew search 软件名
卸载软件
brew uninstall 软件名
删除垃圾
rm -rf "$(brew --cache)" && brew cleanup
微信插件安装#
配合 alfred 的使用,有微信多开 防撤回功能
首次使用安装 WeChatTweak-CLI:
brew install sunnyyoung/repo/wechattweak-cli
安装/更新/卸载 Tweak:
$ sudo wechattweak-cli install # 安装/更新 $ sudo wechattweak-cli uninstall # 卸载
Bug#
brew install 时 出现
Error: Command failed with exit 128: git
问题
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
Mac 解决安装brew卡在 “Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core‘...”
cd /usr/local/Homebrew/Library/Taps/ mkdir homebrew cd homebrew git clone https://mirrors.ustc.edu.cn/homebrew-core.git brew update
安装内容报错
Error: redis@3.2 has been disabled because it is a versioned formula!
- 首先找到文件
/opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/redis@3.2.rb
- 找到disabel这一行,然后注释掉(就是在前面加个#);
# disable! date: "2022-11-28", because: :versioned_formula
- 重新安装
Mac
Mac打开全部来源#
sudo spctl --master-disable
Mac自带终端代码高亮 补全#
高亮: fast-syntax-highlighting
brew install fast-syntax-highlighting
补全: zsh-autosuggestions
brew install zsh-autosuggestions
在 .zshrc
文件添加配置
#代码高亮 source /opt/homebrew/Cellar/zsh-fast-syntax-highlighting/1.55/share/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh #代码补全 source /opt/homebrew/Cellar/zsh-autosuggestions/0.7.0/share/zsh-autosuggestions/zsh-autosuggestions.zsh
软件损坏请移至废纸篓#
方案1
此选项将允许您绕过特定应用程序的隔离。请注意,该命令包括应用程序或图像(.dmg)的路径。
这个过程通常被称为“去隔离”或“去隔离”。
使用以下命令:sudo xattr -r -d com.apple.quarantine 放置一个空格并将损坏的程序或图像 (.dmg) 拖入终端窗口。团队将完成。
或者使用命令:sudo xattr -r -c 放置一个空格并将损坏的程序或图像(.dmg)拖入终端窗口。团队将完成。
通常,仅使用第一个命令就足够了,但在某些情况下,它的执行没有帮助,这与执行第二个命令不同。开始启动损坏的程序。
等待支票完成,你将能够打开它。
验证时间最多可能需要 30 分钟。
方案2
此命令将允许您禁用门禁,即恢复允许在系统偏好设置/保护和安全性中使用从任何来源下载的程序的设置。
使用命令:sudo spctl --master-disable
您无需将任何东西拖到终端。要启用门禁,请将“禁用”替换为“启用”。
终端命令行 E325: ATTENTION
#
E325: ATTENTION Found a swap file by the name ".bash_profile.swp" owned by: root dated: Fri Aug 25 16:23:42 2017 file name: ~root/.bash_profile modified: no user name: root host name: h********deMacBook-Pro.local process ID: 5025 (still running) While opening file ".bash_profile" (1) Another program may be editing the same file. If this is the case, be careful not to end up with two different instances of the same file when making changes. Quit, or continue with caution. (2) An edit session for this file crashed. If this is the case, use ":recover" or "vim -r .bash_profile" to recover the changes (see ":help recovery"). If you did this already, delete the swap file ".bash_profile.swp" to avoid this message.
非正常关闭
vim/vi
在编辑的文件时会创建一个交换文件.swp 文件以保证文件的安全性
我们只要将这个文件删除就OK了
rm -f .bash_profile.swp
command not found: vim
#
因为vim正在能在任何路径下运行的指令肯定是在PATH路径下有配置,你后加了什么新的路径到PATH里如果写错了那就整个PATH里的所有都用不了了
将配置文件(bash_profile) 的内容修改正确
作者:Bikakaso
出处:https://www.cnblogs.com/Bikakaso/p/machomebrew.html
版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」许可协议进行许可。
本文来自博客园,作者:Bikakaso,转载请注明原文链接:https://www.cnblogs.com/Bikakaso/p/machomebrew.html
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步