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或其他软件。

相关推荐
pe7er5 天前
macOS 应用无法打开(权限问题)解决方案
macos·mac
harmful_sheep7 天前
mac生效的终端查看
macos
iOS门童8 天前
macOS 应用"已损坏"无法打开?一文搞懂 Gatekeeper 与解决方案
macos
NPE~8 天前
[工具分享]Maccy —— 优雅的 macOS 剪贴板历史管理工具
macos·教程·工具·实用工具
差不多程序员8 天前
Mac安装OpenClaw-cn保姆级教程
macos
dzl843948 天前
mac 安装python
开发语言·python·macos
Bruce_Liuxiaowei8 天前
在 macOS 上通过 Docker 本地安装 OpenClaw 完整教程
macos·docker·容器·openclaw
阿捏利8 天前
详解Mach-O(十五)Mach-O __DATA_CONST
macos·ios·c/c++·mach-o
ShikiSuen8 天前
macOS 的 CpLk 中英切换卡顿的元凶在 InputMethodKit 本身
macos
xiayutian_c8 天前
如虎添翼-MacOS
macos