首页 > 其他分享 >Mac安装brew

Mac安装brew

时间:2023-12-17 16:34:58浏览次数:29  
标签:git -- repo Mac https brew homebrew 安装

介绍

Homebrew是一款包管理工具,目前支持macOS和Linux系统。主要有四个部分组成:brew、homebrew-core 、homebrew-cask、homebrew-bottles。

安装

执行安装脚本

执行

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

选阿里巴巴。
image

image

验证安装成功

执行brew --version 验证是否安装成功。
image

更换下载源

# 更换brew.git
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git # 中科大
或
git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git # 阿里巴巴
或
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git # 清华大学
# 更换homebrew-core.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git # 中科大
或
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git # 阿里巴巴
或
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git # 清华大学
# 更换homebrew-cask.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git # 中科大
或
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-cask.git # 阿里巴巴
或
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git # 清华大学
# 更换homebrew-bottles
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile # 阿里云
或
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.bash_profile # 中科大
或
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles' >> ~/.bash_profile # 清华大学

source ~/.bash_profile

如果终端使用的是zsh,就写入zsh的配置文件中。

更新软件包

执行brew update,如果可以更新成功,更换的源可用。

恢复默认源

某些情况下,可能我们使用的国内源挂掉了,就需要恢复默认源。

1. git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
2. git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
3. git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
4. 删除环境变量 HOMEBREW_BOTTLE_DOMAIN
5. source ~/.bash_profile
6. brew update

意外处理

先执行brew doctor查看问题,按照指示对问题进行修复
执行brew update-reset 将homebrew还原到稳定版
执行brew update 更新软件包

常用命令

安装软件

brew install node 默认安装最新版
brew install [email protected] 安装指定版本
brew switch node 16.0.0 切换版本

更新软件

brew upgrade name 更新安装过的软件(如果不加软件名,就更新所有可以更新的软件)

卸载软件

brew uninstall node 卸载node

服务相关

brew services list 获取services列表
brew services start/stop/restart serverName
brew services start mysql 启动mysql服务
brew services restart mysql 重启mysql服务
brew services stop mysql 停止mysql服务

其他常用命令

brew config 查看brew配置
brew info node 查看node安装信息
brew list 查看已安装软件
brew list --versions 查看已安装软件版本号
brew search node 搜索可用node相关软件
brew update brew自身更新
brew cleanup 清除下载的缓存
brew doctor 诊断brew,并给出修复命令

卸载Homebrew

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

标签:git,--,repo,Mac,https,brew,homebrew,安装
From: https://www.cnblogs.com/aeolian/p/17909199.html

相关文章

  • Windows利用nvm进行node版本控制(node 版本管理工具nvm的安装与使用)
    为什么需要对node进行版本管理?不同项目的node的版本并不相同,不同版本之间的兼容性并不好,所以需要工具(node版本管理工具)进行快速切换node版本。下载与安装(Windows)1.卸载电脑原有node直接去控制面板/win11设置卸载就行2.安装nvmGithub下载地址下载地址里面有两类nv......
  • mac系统使用NTFS移动硬盘只读问题
    查看硬盘状态diskutilinfo/Volumes/秋雨mount命令也能看出磁盘挂载位置尝试使用makedir命令新建文件夹,提示只读解决方案#查看挂载的磁盘mount#卸载挂载的磁盘sudoumount/dev/disk4s1#以读写模式重新挂载:#新建一个目录$mkdir~/flashdisk#使用mount_ntfs命令......
  • 02.环境安装与使用
    目前mobile自动化解决方案iOSAndroidCalabash-iOScalabash-AndroidFrankMonkeyTalkUIAutomationRobotiumiOS-driverUIAutomatorKeepItFunctionalSelendroidMacacaMacacaAppiumAppium 自动化工具选择工具名称被测系统脚本语言是否支......
  • VMware workstation中安装的centos虚拟机ip自动获取可以上网,设置静态ip不能上网问题解
    一、需求   linux中我们会设置hosts文件,这会涉及ip和域名的设置,但是如果虚拟机自动获取ip地址的话,这就意味着之前设置的hosts文件需要重新修改,所以我们需要设置虚拟机为静态ip地址。二、故障现象   我linux虚拟机最开始是自动获取的ip地址,用的nat模式,是可以上网的,......
  • pygame安装问题
    pygame的安装问题(1)python-mpipinstall--upgradepip(2)pipinstallpygame(3)更换下载网站,且赋予信任pipinstallpygame-ihttp://pypi.douban.com/simple--trusted-hostpypi.douban.com(4)python-mpipinstall-Upygame--user(5)python-mpipinstall-Upy......
  • Mysql安装
              ---------------------------------------------Mysql命令1-------------------------------------------------##mysql命令~~~python#默认端口号3306#登录命令:mysql-uroot-p#修改密码命令(在mysql之外进行,可以不登录):mysqladmi......
  • MySQL 8.2.0部署安装验证
    MySQL8.2.0部署安装验证背景昨天捯饬了半天Oracle23cFree版本发现自己白忙活了.然后想着继续看一下MySQL8.2.看看会不会又继续白忙活下载与安装https://cdn.mysql.com//Downloads/MySQL-8.2/mysql-8.2.0-1.el8.x86_64.rpm-bundle.tar计划是下载tar包,这样比较简单......
  • Eclipse在线安装SVN插件
    环境:Win10、eclipse2013-12(javaversion"1.8.0_221")先下载jdk安装完成,并配置好环境变量,因为eclipse启动需要依赖jdk环境。eclipse无需安装,解压使用,进入解压目录,双击eclipse.exe执行即可。电脑可以联网,按照以下步骤在线安装svn资源管理器。这一步可以先点击Installed,确保当前没......
  • ubuntu22.04安装Goland2022.2.4
    ubuntu22.04安装Goland2022.2.4自行下载Goland版本下载golandwgethttps://download.jetbrains.com/go/goland-2022.2.4.tar.gz./将下载的压缩文件解压到指定目录sudotar-zxvfgoland-2022.2.4.tar.gz-C/tools/goland启动试运行golandcd/tools/goland/GoLand......
  • TDSQL DBBRIDGE安装文档
    一、环境操作系统:CentOS7.964位二、步骤:2.1yuminstall-ylibiculibicu-developenssl-develOpenSSLgccunzipperl-ExtUtils-Embedlibxslttcljava-1.8.0-openjdkreadline-develflex2.2上传并解压缩zip文件cd/dataunzipe8322a26-f049-44e9-aad1-abff0dacf4......