username@usernamedeMacBook-Pro /opt % /bin/bash -c " $ (curl -fsSL https:
/bin/bash: -c: line 0: syntax error near unexpected token `curl'
/bin/bash: -c: line 0: ` $ (curl -fsSL https:
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt % /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
xcode-select: note: No developer tools were found, requesting install.
If developer tools are located at a non-default location on disk, use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, and cancel the installation dialog.
See `man xcode-select` for more details.
请安装Git后再运行此脚本,在系统弹窗中点击“安装”按钮
如果没有弹窗可能你系统太老了,brew只支持Mac三个大版本号
xcode-select: note: install requested for command line developer tools
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt % xcode-select --install
xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates
username@usernamedeMacBook-Pro /opt % Software Update
zsh: command not found: Software
username@usernamedeMacBook-Pro /opt % softwareupdate
usage: softwareupdate <cmd> [<args> ...]
** Manage Updates:
-l | --list List all appropriate update labels (options: --no-scan, --product-types)
-d | --download Download Only
-i | --install Install
<label> ... specific updates
-a | --all All appropriate updates
-R | --restart Automatically restart (or shut down) if required to complete installation.
-r | --recommended Only recommended updates
--os-only Only OS updates
--safari-only Only Safari updates
--stdinpass Password to authenticate as an owner. Apple Silicon only.
--user Local username to authenticate as an owner. Apple Silicon only.
--list-full-installers List the available macOS Installers
--fetch-full-installer Install the latest recommended macOS Installer
--full-installer-version The version of macOS to install. Ex: --full-installer-version 10.15
--install-rosetta Install Rosetta 2
--background Trigger a background scan and update operation
** Other Tools:
--dump-state Log the internal state of the SU daemon to /var/log/install.log
--evaluate-products Evaluate a list of product keys specified by the --products option
--history Show the install history. By default, only displays updates installed by softwareupdate.
** Options:
--no-scan Do not scan when listing or installing updates (use available updates previously scanned)
--product-types <type> Limit a scan to a particular product type only - ignoring all others
Ex: --product-types macOS || --product-types macOS,Safari
--products A comma-separated (no spaces) list of product keys to operate on.
--force Force an operation to complete. Use with --background to trigger a background scan regardless of "Automatically check" pref
--agree-to-license Agree to the software license agreement without user interaction.
--verbose Enable verbose output
--help Print this help
username@usernamedeMacBook-Pro /opt % softwareupdate -l
Software Update Tool
Finding available software
Software Update found the following new or updated software:
* Label: macOS Sequoia 15.5-24F74
Title: macOS Sequoia 15.5, Version: 15.5, Size: 6382124KiB, Recommended: YES, Action: restart,
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt % git -version
unknown option: -version
usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[--super-prefix=<path>] [--config-env=<name>=<envvar>]
<command> [<args>]
username@usernamedeMacBook-Pro /opt % git --version
git version 2.39.5 (Apple Git-154)
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt % xcode-select --install
xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt %
username@usernamedeMacBook-Pro /opt % /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
git version 2.39.5 (Apple Git-154)
开始执行Homebrew自动安装程序
[cunkai.wang@foxmail.com]
['2025-07-05 23:00:11']['15.1']
请选择下列一个 数字编号 后回车
(这里只是下载brew,随意选。国内下载源有5种稍后让你选择配置)
1、通过清华大学下载brew
2、通过Gitee下载brew
3、!我已经安装brew,跳过克隆,直接带我去配置国内下载源
4、不克隆brew,只把仓库地址设置成Gitee
5、不克隆brew,只把仓库地址设置成清华大学
请输入序号: 2
你选择了Gitee brew本体下载源
Mac os设置开机密码方法:
(设置开机密码:在左上角苹果图标->系统偏好设置->用户与群组->更改密码)
(如果提示This incident will be reported. 在用户与群组中查看是否管理员)
请输入开机密码,输入过程不显示,输入完后回车
Password:
已获取权限
==> 安装过程开始调用Brew官方安装脚本,提示会变成英文,看不懂的复制到在线翻译。
如果下载速度慢可以ctrl+c或control+c重新运行脚本选择下载源
-> !!!!是否删除之前本机安装的Brew(是Y 否N) 我没有检测本机是否安装brew,选哪个都会继续运行
(Y/N): y
--> 脚本开始执行
未发现Git代理(属于正常状态)
开始 进入brew官方安装脚本 开始
下载官方install.sh文件,当前目录是: /Users/username
Cloning into 'brew-install-ck'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 21 (delta 0), reused 3 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (21/21), 22.25 KiB | 1.31 MiB/s, done.
==> Checking for `sudo` access (which may request your 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/bin
/opt/homebrew/etc
/opt/homebrew/include
/opt/homebrew/lib
/opt/homebrew/sbin
/opt/homebrew/share
/opt/homebrew/var
/opt/homebrew/opt
/opt/homebrew/share/zsh
/opt/homebrew/share/zsh/site-functions
/opt/homebrew/var/homebrew
/opt/homebrew/var/homebrew/linked
/opt/homebrew/Cellar
/opt/homebrew/Caskroom
/opt/homebrew/Frameworks
Press RETURN/ENTER 现在是brew官方安装提示,它需要你按回车键开始 other key to abort:
==> /usr/bin/sudo /usr/bin/install -d -o root -g wheel -m 0755 /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown username /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /opt/homebrew/bin /opt/homebrew/etc /opt/homebrew/include /opt/homebrew/lib /opt/homebrew/sbin /opt/homebrew/share /opt/homebrew/var /opt/homebrew/opt /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions /opt/homebrew/var/homebrew /opt/homebrew/var/homebrew/linked /opt/homebrew/Cellar /opt/homebrew/Caskroom /opt/homebrew/Frameworks
==> /usr/bin/sudo /usr/sbin/chown -R username:admin /opt/homebrew
==> /usr/bin/sudo /bin/mkdir -p /Users/username/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/username/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R username /Users/username/Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 304870, done.
remote: Counting objects: 100% (304870/304870), done.
remote: Compressing objects: 100% (84008/84008), done.
remote: Total 304870 (delta 219176), reused 294789 (delta 211969), pack-reused 0 (from 0)
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (34/34), done.
remote: Total 55 (delta 34), reused 34 (delta 34), pack-reused 21 (from 1)
==> Fetching /opt/homebrew...
==> Resetting /opt/homebrew...
Reset branch 'stable'
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https:
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:
==> Next steps:
- Run these commands in your terminal to add Homebrew to your PATH:
echo >> /Users/username/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/username/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
https:
此步骤成功
Password:
完成 退出brew官方安装脚本 完成
==> 配置国内镜像源HOMEBREW BOTTLE
此处如果显示Password表示需要再次输入开机密码,输入完后回车
sed: /Users/username/.zprofile: No such file or directory
有些电脑xcode和git混乱,再运行一次,此处如果有error正常。
xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates
Homebrew已经安装成功,接下来配置国内软件下载源。
请选择今后brew install的时候访问那个国内镜像,例如阿里巴巴,输入5回车。
1、中科大国内源
2、清华大学国内源
3、上海交通大学国内源
4、腾讯国内源
5、阿里巴巴国内源(推荐)
请输入序号: 5
你选择了阿里巴巴国内源
环境变量写入->/Users/username/.zprofile
此步骤成功
==> 安装完成,brew版本
Homebrew 4.5.8
Homebrew前期配置成功
==> Updating Homebrew...
==> Downloading https:
######################################################################################################################################################################################################################################################## 100.0%
==> Pouring portable-ruby-3.4.4.arm64_big_sur.bottle.tar.gz
==> Homebrew collects anonymous analytics.
Read the analytics documentation (and how to opt-out) here:
https:
No analytics have been recorded yet (nor will be during this `brew` run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https:
Already up-to-date.
Homebrew自动安装程序运行完成
国内地址已经配置完成
之前步骤选了删除本机brew的话,桌面多出一个Old_Homebrew文件夹,可以删除。
初步介绍几个brew命令
查看版本:brew -v 更新brew版本:brew update
查找:brew search python(其中python替换为要查找的关键字)
安装:brew install python(其中python替换为要安装的名称)
本地软件库列表:brew ls
如果遇到问题可以右键下面地址查看常见错误解决办法
https:
brew官方地址:https:
安装成功 但还需要重启终端 或者 运行 source /Users/username/.zprofile 否则国内地址无法生效
username@usernamedeMacBook-Pro /opt % source /Users/username/.zprofile
username@usernamedeMacBook-Pro /opt % brew -v
Homebrew 4.5.8
username@usernamedeMacBook-Pro /opt %