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

相关推荐
txinyu的博客14 小时前
MAC 地址
服务器·网络·macos
小胖红16 小时前
Xcode 打包失败 处理
ide·macos·xcode
June bug17 小时前
【实习笔记】客户端基础技术
笔记·macos·cocoa
HiTomcat19 小时前
一键自动化部署 macOS 开发环境
运维·macos·自动化
海棠AI实验室1 天前
第 4 篇:为什么选择 Cloudflare Tunnel——在“无公网 IP + 零端口暴露”前提下,把家里 Mac 变成可交付的线上服务
tcp/ip·macos·智能路由器
TESmart碲视1 天前
Mac多显示器支持:TESmart USB-C KVM(搭载DisplayLink技术)全面解析
macos·计算机外设·音视频·外设·kvm切换器·tesmart
开开心心_Every2 天前
免费窗口置顶小工具:支持多窗口置顶操作
服务器·前端·学习·macos·edge·powerpoint·phpstorm
蜜汁小强2 天前
macOS 上卸载并重新安装HomeBrew
macos
新手村领路人2 天前
macOS 原生自带的缩放功能设置
macos
小胖燕2 天前
macOS 系统本地部署 CVAT 进行数据标注
macos·cvat