当前位置: 首页 > news >正文

macos:安装brew

一,查看当前版本:

% brew --version
zsh: command not found: brew

二,安装brew

执行命令:

/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/Homebrew.sh)"      
git version 2.39.5 (Apple Git-154)开始执行Homebrew自动安装程序 [cunkai.wang@foxmail.com] ['2026-03-29 11:26:04']['15.7']请选择下列一个 数字编号 后回车
(这里只是下载brew,随意选。国内下载源有5种稍后让你选择配置)1、通过清华大学下载brew
2、通过Gitee下载brew
3、!我已经安装brew,跳过克隆,直接带我去配置国内下载源
4、不克隆brew,只把仓库地址设置成Gitee
5、不克隆brew,只把仓库地址设置成清华大学请输入序号: 1你选择了清华大学brew本体下载源Mac os设置开机密码方法:(设置开机密码:在左上角苹果图标->系统偏好设置->用户与群组->更改密码)(如果提示This incident will be reported. 在用户与群组中查看是否管理员) 
请输入开机密码,输入过程不显示,输入完后回车
Password:
Sorry, try again.
Password:
已获取权限==> 安装过程开始调用Brew官方安装脚本,提示会变成英文,看不懂的复制到在线翻译。如果下载速度慢可以ctrl+c或control+c重新运行脚本选择下载源->  !!!!是否删除之前本机安装的Brew(是Y  否N) 我没有检测本机是否安装brew,选哪个都会继续运行  (Y/N):   Y--> 脚本开始执行
未发现Git代理(属于正常状态)开始  进入brew官方安装脚本  开始下载官方install.sh文件,当前目录是: /Users/Zhuanz1
Cloning into 'brew-install-ck'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 24 (delta 0), reused 15 (delta 0), pack-reused 0
Receiving objects: 100% (24/24), 23.39 KiB | 826.00 KiB/s, done.
==> Checking for `sudo` access (which may request your password)...
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/sbin
/usr/local/share
/usr/local/var
/usr/local/opt
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew
/usr/local/var/homebrew/linked
/usr/local/Cellar
/usr/local/Caskroom
/usr/local/FrameworksPress RETURN/ENTER 现在是brew官方安装提示,它需要你按回车键开始 other key to abort:
==> /usr/bin/sudo /bin/mkdir -p /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod ug=rwx /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/chmod go-w /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown Zhuanz1 /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/sbin /usr/local/share /usr/local/var /usr/local/opt /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew /usr/local/var/homebrew/linked /usr/local/Cellar /usr/local/Caskroom /usr/local/Frameworks
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
==> /usr/bin/sudo /usr/sbin/chown -R Zhuanz1:admin /usr/local/Homebrew
==> Downloading and installing Homebrew...
remote: Enumerating objects: 326280, done.
remote: Counting objects: 100% (105395/105395), done.
remote: Compressing objects: 100% (13132/13132), done.
remote: Total 326280 (delta 103817), reused 92307 (delta 92263), pack-reused 220885
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (35/35), done.
remote: Total 55 (delta 35), reused 35 (delta 35), pack-reused 20
==> Fetching /usr/local/Homebrew...
From https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew* [new branch]            master     -> origin/master==> Resetting /usr/local/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://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://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew#donations==> Next steps:
- Run these commands in your terminal to add Homebrew to your PATH:echo >> /Users/Zhuanz1/.zprofileecho 'eval "$(/usr/local/bin/brew shellenv zsh)"' >> /Users/Zhuanz1/.zprofileeval "$(/usr/local/bin/brew shellenv zsh)"
- Run brew help to get started
- Further documentation:https://docs.brew.sh此步骤成功
Password:完成  退出brew官方安装脚本  完成==> 配置国内镜像源HOMEBREW BOTTLE     
此处如果显示Password表示需要再次输入开机密码,输入完后回车
sed: /Users/Zhuanz1/.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 updatesHomebrew已经安装成功,接下来配置国内软件下载源。请选择今后brew install的时候访问那个国内镜像,例如阿里巴巴,输入5回车。1、中科大国内源
2、清华大学国内源
3、上海交通大学国内源
4、腾讯国内源
5、阿里巴巴国内源(推荐) 
请输入序号: 5你选择了阿里巴巴国内源环境变量写入->/Users/Zhuanz1/.zprofile此步骤成功==> 安装完成,brew版本Homebrew 5.1.1
Homebrew前期配置成功
==> Updating Homebrew...
==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/portable-ruby-4.0.1.catalina.bottle.tar.gz
curl: (56) The requested URL returned error: 404==> Downloading https://ghcr.io/v2/homebrew/core/portable-ruby/blobs/sha256:e4f27cef5f72bf7a99c748c0650fe3718fe661a56960dedaeec9c2c98de1d3bc
############################################################################################################################################################################### 100.0%
==> Pouring portable-ruby-4.0.1.catalina.bottle.tar.gz
==> Homebrew collects anonymous analytics.
Read the analytics documentation (and how to opt-out) here:https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).==> Homebrew is run entirely by unpaid volunteers. Please consider donating:https://github.com/Homebrew/brew#donationsAlready up-to-date.Homebrew自动安装程序运行完成国内地址已经配置完成之前步骤选了删除本机brew的话,桌面多出一个Old_Homebrew文件夹,可以删除。初步介绍几个brew命令
查看版本:brew -v  更新brew版本:brew update
查找:brew search python(其中python替换为要查找的关键字)
安装:brew install python(其中python替换为要安装的名称)
本地软件库列表:brew ls如果遇到问题可以右键下面地址查看常见错误解决办法https://gitee.com/cunkai/HomebrewCN/blob/master/error.mdhttps://gitee.com/cunkai/HomebrewCN/issuesbrew官方地址:https://brew.sh/zh-cn/安装成功 但还需要重启终端 或者 运行 source /Users/Zhuanz1/.zprofile   否则国内地址无法生效

三,查看效果:

% source /Users/Zhuanz1/.zprofile
% brew --version
Homebrew 5.1.1

 

http://www.jsqmd.com/news/554364/

相关文章:

  • 泸州平康医院(结石病研究中心)丨专注结石病诊疗,微创保胆保肾一站式服务
  • ACE-Step快速部署指南:ComfyUI工作流详解,小白也能轻松玩转AI音乐
  • 富文本编辑器选型避坑指南:从14款主流编辑器中筛选出最适合你的
  • MogFace-large模型在智慧零售中的应用:顾客属性分析与客流统计
  • Umi-OCR:免费离线OCR工具,轻松搞定图片文字提取与PDF识别
  • Windows下OpenClaw对接nanobot:QQ机器人配置全流程
  • 2026年辽宁好用的公考选岗机构排名,有小程序助力选岗的推荐 - mypinpai
  • 电气基础知识
  • 自动化测试正在从代码走向“人眼级判断”
  • 终极指南:3步在3DS上原生运行GBA游戏,告别模拟器延迟!
  • ENVI 5.3 打不开 Landsat 9 数据?别急,教你手动修改 MTL 头文件搞定它
  • 突破字幕阅读障碍:Buzz智能字幕长度控制技术深度解析
  • 手把手教你用Arduino IDE配置JC3636W518C开发板(附ESP32-S3R8驱动指南)
  • 公考选岗怕踩坑找正规机构,哈尔滨哪家靠谱? - 工业品网
  • 跨平台开发避坑:海康SDK在Linux下PRO_LoginHikDevice失败的依赖冲突解析
  • 别再折腾了!Win11下用GoLand一键搞定Fyne GUI开发环境(附环境检查工具)
  • 本地AI剪辑:让视频处理效率提升10倍的开源工具全攻略
  • PathOfBuilding:流放之路玩家的离线构建神器,打造最强角色规划方案
  • 遥感影像裁剪避坑指南:如何用ENVI5.3的Subset功能精准提取县区数据(含背景值设置技巧)
  • 说说潍坊高性价比的百度推广公司,瑞兴广告靠谱吗 - 工业品牌热点
  • 3步突破生态壁垒:海尔智能家居跨平台整合的开源解决方案
  • KMS_VL_ALL_AIO:5分钟快速激活Windows和Office的终极解决方案
  • UEFI启动全流程拆解:从按下电源键到系统加载的幕后故事
  • LivePortrait:突破性AI肖像动画技术,让静态照片瞬间“活“起来
  • calibre-do-not-translate-my-path技术解析:解决中文路径翻译问题的本地化方案实践指南
  • 完整指南:如何使用Equalizer APO实现专业级音频均衡优化
  • 从无线通信到芯片设计:一文搞懂展频技术的3种调变方式及实际应用
  • 探讨2026年财务服务企业价格,瀚通金融收费合理 - 工业推荐榜
  • GetQzonehistory完整指南:数字记忆备份的社交媒体数据归档工具
  • FGSM对抗攻击实战:从理论到PyTorch代码的完整攻防演练