美文网首页
Homebrew的安装和使用

Homebrew的安装和使用

作者: 小和大大 | 来源:发表于2023-03-09 16:19 被阅读0次

一、Homebrew是什么?Homebrew的安装和使用

Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,十分方便快捷。
二、Homebrew的安装

1.打开终端(terminal)
2.安装命令:

  命令1:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"(这个命令不好使会报错,如果报错尝试使用命令2)
  命令2:/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"(这是一个脚本,同样可以安装Homebrew)

3.卸载命令:

  $ cd `brew --prefix`
  $ rm -rf Cellar
  $ brew prune
  $ rm `git ls-files`
  $ rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
  $ rm -rf .git
  $ rm -rf ~/Library/Caches/Homebrew

三、Homebrew的使用

1.查看Homebrew命令:brew help
2.安装任意包:brew install <packageName>,eg:brew install node
3.卸载任意包:brew uninstall <packageName>,eg:brew uninstall git
4.查询可用包:brew search <packageName>
5.查询已安装包列表:brew list
6.查看任意包信息:brew info <packageName>
7.更新Homebrew:brew update
8.Homebrew帮助信息:brew -h
8.查看brew版本:brew -v
10.更新brew版本:brew update
11.整理重复语句:open ~/.zshrc -e、open ~/.bash_profile -e

四、其他问题
报错fatal: not in a git directory Error: Command failed with exit 128:

运行以下命令检查:

brew doctor

可以看到有两个warning:homebrew-cask和homebrew-core not tapped properly!

git config --global --add safe.directory homebrew-cask的路径
git config --global --add safe.directory homebrew-core的路径

————————————————
原文链接:https://blog.csdn.net/plpldog/article/details/109923876
https://zhuanlan.zhihu.com/p/550755873?utm_id=0

相关文章

网友评论

      本文标题:Homebrew的安装和使用

      本文链接:https://www.haomeiwen.com/subject/kbeoldtx.html