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

相关推荐
degree5206 小时前
全平台轻量浏览器推荐|支持Win/macOS/Linux,极速加载+隐私保护+扩展插件,告别广告与数据追踪!
windows·macos·电脑
冯浩(grow up)13 小时前
macos 安装nodepad++ (教程+安装包+报错后的解决方法)
macos
2501_928094651 天前
Ps 2025 图像编辑 Photoshop(Mac中文)
图像处理·macos·photoshop·ps
Magnetic_h2 天前
【iOS】锁的原理
笔记·学习·macos·ios·objective-c·cocoa·xcode
Cosmoshhhyyy2 天前
mac环境下安装git并配置密钥等
git·macos
肥肥呀呀呀2 天前
mac 安卓模拟器 blueStacks
macos
csdn_aspnet2 天前
如何在 MacOS 上安装 SQL Server
macos·sqlserver
共享家95273 天前
linux-数据链路层
linux·网络·macos
CZIDC4 天前
MacOS字体看起来比在 Windows 上更好?
macos
Cosmoshhhyyy4 天前
linux远程部署dify和mac本地部署dify
linux·运维·macos