mac homebrew配置使用

本文介绍mac上homebrew工具的安装、配置过程。homebrew功能类似于centos的yum,用于软件包的管理,使用上有命令的差异。

本次配置过程使用mac,看官方文档,在linux上也可以用,但我没试过,有兴趣的同学可以试试。

1、安装

打开终端,复制如下命令:

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

这个要花几分钟,安装过程中要下载,别着急。完成后,效果如下:

看一下版本:

bash 复制代码
brew -v

2、更换源

homebrew默认的源在国外,国内使用时老是超时,我们换成国内源便于使用。先看一下当前的源:

bash 复制代码
cd "$(brew --repo)" && git remote -v

看见了吧,咱们现在改成清华大学的。

bash 复制代码
#··1、换源
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

#··2、修改zshrc文件 
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

#··3、更新
brew update

等待update完成,就可以用homebrew安转软件了。

3、homebrew常用命令

  • brew search 名称 : 查找
  • brew install 名称@版本 : 安装对应版本的软件
  • brew services start 名称: 启动服务
  • brew services info 名称:查看服务信息,包括运行、停止等状态
  • brew uninstall 名称:卸载
  • brew --help: homebrew的帮助,比较简单

4、装个redis试试

bash 复制代码
brew install redis
brew services list 

由上图看出,redis目前处于运行状态,进入redis再看看,直接连接:

bash 复制代码
redis-cli

# 连接成功后,再看看server信息
# 注意,这个命令不是bash命令,是redis链接成功后,redis客户端的命令。
info server 

redis安装成功了,你可以试试mysql或其他软件。

相关推荐
尽兴-1 小时前
MacOS 一键清理指定目录下老旧node_modules
macos
雾蓝回针15 小时前
[全网首发]解决Parallels Desktop运行“第五人格“时 使用涂鸦/快捷发言会导致视角偏移的问题
笔记·macos
这儿有一堆花1 天前
视频文件的技术逻辑解析
windows·macos
Sheffi661 天前
iOS Crash 本质与捕获修复方案
macos·ios·cocoa
喵霓1 天前
mac—android-platform-tools介绍
android·macos
malajisi011 天前
鸿蒙PC开发笔记一:HarmonyOS PC 命令行适配指南(Mac 版)
笔记·macos·harmonyos·harmony·鸿蒙pc·harmony pc
喵霓1 天前
mac——安装wget
macos
bioinforiver1 天前
蛋白质设计(六)— — 三剑合璧,mac如何安装ProteinMPNN、Alphafold2
macos
Charles Shan1 天前
Mac上的linux虚拟机踩坑日记
linux·macos
老菜鸟YDZ1 天前
二十多年前的苹果电脑Power Mac G4 MDD音箱修复
macos·苹果电脑·power mac g4·音箱修复