24 11 2022

SkyMacBookPro:~ demon$ /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" 开始执行Brew自动安装程序 [cunkai.wang@foxmail.com] ['2022-07-11 09:22:27']['10.15'] https://zhuanlan.zhihu.com/p/111014448 请选择一个下载brew本体的序号,例如中科大,输入1回车。 源有时候不稳定,如果git克隆报错重新运行脚本选择源。 1、中科大下载源 2、清华大学下载源 3、北京外国语大学下载源 4、腾讯下载源 5、阿里巴巴下载源 请输入序号: 2 你选择了清华大学brew本体下载源 !!!此脚本将要删除之前的brew(包括它下载的软件),请自行备份。 ->是否现在开始执行脚本(N/Y) y --> 脚本开始执行 Mac os设置开机密码方法: (设置开机密码:在左上角苹果图标->系统偏好设置->用户与群组->更改密码) (如果提示This incident will be reported. 在用户与群组中查看是否管理员) ==> 通过命令删除之前的brew、创建一个新的Homebrew文件夹 请输入开机密码,输入过程不显示,输入完后回车 开始执行 ---备份要删除的/usr/local/Homebrew到系统桌面.... ---/usr/local/Homebrew 备份完成 -> 创建文件夹 /usr/local/Homebrew 运行代码 ==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew 此步骤成功 运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /usr/local/Homebrew 运行代码 ==> /usr/bin/sudo /usr/sbin/chown demon /usr/local/Homebrew 运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew git version 2.23.0 下载速度觉得慢可以ctrl+c或control+c重新运行脚本选择下载源 ==> 从 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git 克隆Homebrew基本文件 未发现Git代理(属于正常状态) 正克隆到 '/usr/local/Homebrew'... remote: Enumerating objects: 211575, done. remote: Counting objects: 100% (211575/211575), done. remote: Compressing objects: 100% (55211/55211), done. remote: Total 211575 (delta 156199), reused 204638 (delta 150817) 接收对象中: 100% (211575/211575), 55.30 MiB | 5.87 MiB/s, 完成. 处理 delta 中: 100% (156199/156199), 完成. 此步骤成功 --创建Brew所需要的目录 运行代码 ==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/bin/brew 运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/bin/brew 运行代码 ==> /usr/bin/sudo /usr/sbin/chown -R demon:admin /usr/local/Homebrew 运行代码 ==> /usr/bin/sudo /bin/mkdir -p /Users/demon/Library/Caches/Homebrew 运行代码 ==> /usr/bin/sudo /bin/chmod g+rwx /Users/demon/Library/Caches/Homebrew 运行代码 ==> /usr/bin/sudo /usr/sbin/chown -R demon /Users/demon/Library/Caches/Homebrew --依赖目录脚本运行完成 ==> 创建brew的替身 ==> 从 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git 克隆Homebrew Core 此处如果显示Password表示需要再次输入开机密码,输入完后回车 正克隆到 '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'... remote: Enumerating objects: 1226324, done. remote: Counting objects: 100% (1226324/1226324), done. remote: Compressing objects: 100% (396731/396731), done. remote: Total 1226324 (delta 853452), reused 1189817 (delta 826453) 接收对象中: 100% (1226324/1226324), 410.21 MiB | 5.51 MiB/s, 完成. 处理 delta 中: 100% (853452/853452), 完成. 此步骤成功 ==> 从 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git 克隆Homebrew Cask 图形化软件 此处如果显示Password表示需要再次输入开机密码,输入完后回车 正克隆到 '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask'... remote: Enumerating objects: 654465, done. remote: Counting objects: 100% (654465/654465), done. remote: Compressing objects: 100% (204451/204451), done. remote: Total 654465 (delta 464541), reused 634514 (delta 448461) 接收对象中: 100% (654465/654465), 283.38 MiB | 5.17 MiB/s, 完成. 处理 delta 中: 100% (464541/464541), 完成. 此步骤成功 ==> 从 https://gitee.com/cunkai/homebrew-services.git 克隆Homebrew services 管理服务的启停 正克隆到 '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'... remote: Enumerating objects: 2041, done. remote: Counting objects: 100% (900/900), done. remote: Compressing objects: 100% (447/447), done. remote: Total 2041 (delta 450), reused 877 (delta 430), pack-reused 1141 接收对象中: 100% (2041/2041), 555.72 KiB | 465.00 KiB/s, 完成. 处理 delta 中: 100% (934/934), 完成. 此步骤成功 ==> 配置国内镜像源HOMEBREW BOTTLE 运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /Users/demon/.bash_profile 运行代码 ==> /usr/bin/sudo /usr/sbin/chown demon /Users/demon/.bash_profile 运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /Users/demon/.bash_profile Brew本体已经安装成功,接下来配置国内源。 请选择今后brew install的时候访问那个国内镜像,例如阿里巴巴,输入5回车。 1、中科大国内源 2、清华大学国内源 3、北京外国语大学国内源 4、腾讯国内源 5、阿里巴巴国内源 请输入序号: 2 你选择了清华大学国内源 环境变量写入->/Users/demon/.bash_profile 此步骤成功 运行代码 ==> /usr/bin/sudo /bin/chmod -R a+rwx /usr/local/Homebrew 运行代码 ==> /usr/bin/sudo /usr/sbin/chown demon /usr/local/Homebrew 运行代码 ==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew ==> 安装完成,brew版本 Homebrew 3.5.4-32-g8dd96ae-dirty Homebrew/homebrew-core (git revision e551043878c; last commit 2022-07-10) Homebrew/homebrew-cask (git revision 176a5a8926; last commit 2022-07-10) Brew前期配置成功 电脑系统版本:10.15 ==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles-portable-ruby/portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz ########################################################################################################################### 100.0% ==> Pouring portable-ruby-2.6.8_1.el_capitan.bottle.tar.gz All user-space services OK, nothing cleaned... ==> brew update-reset ==> Fetching /usr/local/Homebrew... ==> Resetting /usr/local/Homebrew... Branch 'master' set up to track remote branch 'master' from 'origin'. Reset branch 'master' Your branch is up to date with 'origin/master'. ==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask... ==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask... Branch 'master' set up to track remote branch 'master' from 'origin'. Reset branch 'master' Your branch is up to date with 'origin/master'. ==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core... ==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core... Updating files: 100% (6229/6229), done. Branch 'master' set up to track remote branch 'master' from 'origin'. Reset branch 'master' Your branch is up to date with 'origin/master'. ==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services... ==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services... Branch 'master' set up to track remote branch 'master' from 'origin'. Reset branch 'master' Your branch is up to date with 'origin/master'. Brew自动安装程序运行完成 国内地址已经配置完成 桌面的Old_Homebrew文件夹,大致看看没有你需要的可以删除。 初步介绍几个brew命令 本地软件库列表:brew ls 查找软件:brew search google(其中google替换为要查找的关键字) 查看brew版本:brew -v 更新brew版本:brew update 安装cask软件:brew install --cask firefox 把firefox换成你要安装的  安装成功 但还需要重启终端 或者 运行 source /Users/demon/.bash_profile 否则可能无法使用 SkyMacBookPro:~ demon$ source /Users/demon/.bash_profile SkyMacBookPro:~ demon$ echo $HOMEBREW_BOTTLE_DOMAIN https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/ SkyMacBookPro:~ demon$ brew search mysql ==> Formulae automysqlbackup mysql++ mysql-client@5.7 mysql-sandbox mysql@5.6 mysqltuner mysql mysql-client mysql-connector-c++ mysql-search-replace mysql@5.7 ✔ qt-mysql ==> Casks mysql-connector-python mysql-shell mysqlworkbench navicat-for-mysql sqlpro-for-mysql SkyMacBookPro:~ demon$

发表评论