macOS 安装 homebrew

Homebrew:macOS(或 Linux)缺失的软件包的管理器

官网:https://brew.sh/

安装homebrew方式区别

官方命令行官方pkg安装国内安装
镜像容易下载推荐页面化安装下载快,中文

命令行

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

安装过程

johnny@MacBook-Pro homebrew % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
==> The following new directories will be created:
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown hongwei /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown -R hongwei:admin /opt/homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 87, done.
remote: Counting objects: 100% (87/87), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 87 (delta 67), reused 87 (delta 67), pack-reused 0 (from 0)
==> Updating Homebrew...
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:d9faa506c014dedc0b034a68103ba75c9a58242f4d6c67b6ca0f649c39602bcf
######################################################################### 100.0%
==> Pouring portable-ruby-3.3.7.arm64_big_sur.bottle.tar.gz
Updated 1 tap (homebrew/core).
Warning: /opt/homebrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run these commands in your terminal to add Homebrew to your PATH:
    echo >> /Users/johnny/.zprofile
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/johnny/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

根据提示配置环境变量

johnny@MacBook-Pro homebrew % brew
zsh: command not found: brew
johnny@MacBook-Pro homebrew % echo >> /Users/johnny/.zprofile
johnny@MacBook-Pro homebrew % echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/johnny/.zprofile
johnny@MacBook-Pro homebrew % eval "$(/opt/homebrew/bin/brew shellenv)"
johnny@MacBook-Pro homebrew % 
johnny@MacBook-Pro homebrew % brew
Example usage:
  brew search TEXT|/REGEX/
  brew info [FORMULA|CASK...]
  brew install FORMULA|CASK...
  brew update
  brew upgrade [FORMULA|CASK...]
  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

pkg安装

在这里插入图片描述
根据提示一直安装即可

配置环境变量

echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.bash_profile 

source ~/.bash_profile

echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc   

source ~/.zshrc

国内地址

安装脚本:

/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)"
macOS安装Homebrew非常简单。你可以按照以下步骤进行安装: 1. 打开终端应用程序。 2. 在终端中输入以下命令并按下回车键,以安装Homebrew: ``` /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ``` 注意:如果以上链接失效,你可以在Homebrew的官方网站上查找最新的安装命令链接。 3. 终端会提示你输入管理员密码,输入密码后按下回车键继续。 4. 等待安装过程完成,安装过程可能需要一些时间,取决于你的网络连接速度。 5. 安装完成后,你可以通过在终端中输入以下命令来验证Homebrew是否成功安装: ``` brew --version ``` 如果你看到Homebrew的版本信息,则表示安装成功。 现在你已经成功在macOS安装Homebrew,你可以使用它来搜索、安装和卸载各种软件包。例如,你可以使用`brew search 软件名`来搜索软件包,使用`brew install 软件名`来安装软件包,使用`brew uninstall 软件名`来卸载软件包,使用`brew update`来更新Homebrew,使用`brew config`来查看Homebrew的配置信息。 希望这些信息对你有帮助!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [MacOS安装Homebrew](https://blog.csdn.net/qq_43783527/article/details/125242300)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *3* [macOS安装Homebrew](https://blog.csdn.net/q383965374/article/details/80404314)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值