0


Homebrew安装使用卸载

Homebrew安装使用卸载

1、安装

国外源脚本执行:

ruby -e"$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

如果执行中出现连接超时等问题,可以尝试执行下面的脚本。

执行安装命令,执行的脚步是国内的开源中国提供的源安装路径(https://gitee.com)

/bin/zsh -c"$(curl-fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

执行之后需要选择下载源

          开始执行Brew自动安装程序
              [[email protected]]['2023-01-06 11:22:38']['13.0']
        https://zhuanlan.zhihu.com/p/111014448

请选择一个下载brew本体的序号,例如中科大,输入1回车。
源有时候不稳定,如果git克隆报错重新运行脚本选择源。
1、中科大下载源
2、清华大学下载源
3、北京外国语大学下载源
4、腾讯下载源
5、阿里巴巴下载源
请输入序号: 1

输入下载源之后等待下载,等待可能会稍微长一些,耐心等待。
安装好之后执行一下brew -v,查看一下当前版本,我执行过之后出现如下情况:

/opt brew -v
Homebrew 3.6.17-57-gea0b786
fatal: detected dubious ownership in repository at '/opt/homebrew/Library/Taps/homebrew/homebrew-core'
To add an exception for this directory, call:

    git config --global--add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: detected dubious ownership in repository at '/opt/homebrew/Library/Taps/homebrew/homebrew-cask'
To add an exception for this directory, call:

    git config --global--add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)

上面有标识,需要执行git config --global,按照上面的提示执行一下相关的命令,如下:

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

执行完成之后,在执行brew -v查看一下是否还会出现fatal信息:

Homebrew 3.6.17-57-gea0b786
Homebrew/homebrew-core (git revision 40f6cac1262; last commit 2023-01-06)
Homebrew/homebrew-cask (git revision 3a51e6f790; last commit 2023-01-05)

2、使用

执行之后查看一下应该是没有问题的,现在安装一下软件看看homebrew是否安装成功

brew install wget
/opt/homebrew (master ✔) brew installwget==> Fetching dependencies for wget: gettext, libunistring, libidn2, ca-certificates and [email protected]
==> Fetching gettext
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/gettext-0.21.1.arm64_ventura.bottle.tar.gz
Already downloaded: /Users/halo/Library/Caches/Homebrew/downloads/1278013e6188ef044a9c3bb644acbb032a608bfe7583db091a8c15f0b5a42c63--gettext-0.21.1.arm64_ventura.bottle.tar.gz
==> Fetching libunistring
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libunistring-1.1.arm64_ventura.bottle.tar.gz
Already downloaded: /Users/halo/Library/Caches/Homebrew/downloads/a8ac0bb0aac2c0e1e2c3413b71b5cd4ed92ce1c9959b8c302050239c30bab50f--libunistring-1.1.arm64_ventura.bottle.tar.gz
==> Fetching libidn2
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libidn2-2.3.4_1.arm64_ventura.bottle.tar.gz
Already downloaded: /Users/halo/Library/Caches/Homebrew/downloads/bff2bb496dedf7d291f5ff6a319d279524031fb35b397eb9bf827f639d47db06--libidn2-2.3.4_1.arm64_ventura.bottle.tar.gz
==> Fetching ca-certificates
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/ca-certificates-2022-10-11.all.bottle.tar.gz
Already downloaded: /Users/halo/Library/Caches/Homebrew/downloads/10a0aa3f1cb1c4bdd31b95b30e6838414c313b5f40761671816349d96125a848--ca-certificates-2022-10-11.all.bottle.tar.gz
==> Fetching [email protected]
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openssl%401.1-1.1.1s.arm64_ventura.bottle.tar.gz
Already downloaded: /Users/halo/Library/Caches/Homebrew/downloads/1c71d0902e75b0c6a93a9aaa12b377db6239fdd53abed53db7304458bd7aa957--openssl@1.1-1.1.1s.arm64_ventura.bottle.tar.gz
==> Fetching wget==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/wget-1.21.3_1.arm64_ventura.bottle.tar.gz
Already downloaded: /Users/halo/Library/Caches/Homebrew/downloads/0ec7f00c7477dd6cfb383eb095f7c73f945ca5a14874eec1a79f07f7a3bf92df--wget-1.21.3_1.arm64_ventura.bottle.tar.gz
==> Installing dependencies for wget: gettext, libunistring, libidn2, ca-certificates and [email protected]
==> Installing wget dependency: gettext
==> Pouring gettext-0.21.1.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/gettext/0.21.1: 1,983 files, 20.9MB
==> Installing wget dependency: libunistring
==> Pouring libunistring-1.1.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libunistring/1.1: 56 files, 5.0MB
==> Installing wget dependency: libidn2
==> Pouring libidn2-2.3.4_1.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libidn2/2.3.4_1: 79 files, 1MB
==> Installing wget dependency: ca-certificates
==> Pouring ca-certificates-2022-10-11.all.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺  /opt/homebrew/Cellar/ca-certificates/2022-10-11: 3 files, 225.4KB
==> Installing wget dependency: [email protected]
==> Pouring [email protected]_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/[email protected]/1.1.1s: 8,101 files, 18MB
==> Installing wget==> Pouring wget-1.21.3_1.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/wget/1.21.3_1: 89 files, 4.2MB
==> Running `brew cleanup wget`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
/opt/homebrew (master ✔)wget
wget: missing URL
Usage: wget[OPTION]... [URL]...

Try `wget --help' formore options.

安装wget之后,执行wget命令,显示

wget: missing URL

,说明安装成功。

执行brew,可以查看brew的帮助文档,上面有些执行命令,如下:

/opt/homebrew (master ✔) brew
Example usage:
  查询应用brew search [应用名]
  brew search TEXT|/REGEX/
  查看应用信息 brew info
  brew info [FORMULA|CASK...]
  安装包
  brew install FORMULA|CASK...
  更新Homebrew
  brew update
  更新包 brew upgrade [应用名]  |如果不加包名就更新全部
  brew upgrade [FORMULA|CASK...]
  卸载包 brew uninstall [应用名]
  brew uninstall FORMULA|CASK...
  查看安装列表
  brew list [FORMULA|CASK...]

Troubleshooting:
  brew config
  brew doctor
  brew install--verbose--debug FORMULA|CASK

Contributing:
  brew create URL [--no-fetch]
  brew edit [FORMULA|CASK...]

Further help:
  brew commands
  查看帮助
  brew help[COMMAND]man brew
  https://docs.brew.sh

不在brew帮助文档里面的命令:
# 清理所有包的旧版本
brew cleanup
# 清理指定包的旧版本
brew cleanup [应用名]# 查看可清理的旧版本包,不执行实际操作
brew cleanup -n# 查询可更新的包
brew outdated
# 锁定某个包
brew pin [应用名]# 取消锁定
brew unpin [应用名]# 查看版本
brew -v

3、卸载

卸载Homebrew 脚本:
国内源卸载

/bin/zsh -c"$(curl-fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"

国外源卸载

/bin/bash -c"$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
标签: homebrew brew

本文转载自: https://blog.csdn.net/exception_class/article/details/128589914
版权归原作者 彷徨的蜗牛 所有, 如有侵权,请联系我们删除。

“Homebrew安装使用卸载”的评论:

还没有评论