【Homebrew】Homebrew 介绍与安装
目录
一. 介绍
1.1 啥是 Homebrew 呢?
1.2 Homebrew 能干啥 ?
1.3 Homebrew 简单命令
二. 安装
2.1 WSL 安装
2.2 切换源
2.3 配置环境变量
2.4 恢复源(可选)
三. 参考
一. 介绍
1.1 啥是 Homebrew 呢?
macOS(或 Linux)缺失的软件包的管理器
1.2 Homebrew 能干啥 ?
我简单收集一下官方的描述,整理如下:
- 使用 Homebrew 安装 Apple(或您的 Linux 系统)没有预装但 你需要的东西。
- Homebrew 会将软件包安装到独立目录,并将其文件软链接至
/usr/local
。 - Homebrew 不会将文件安装到它本身目录之外,所以您可将 Homebrew 安装到任意位置。
- 轻松创建你自己的 Homebrew 包。
- 完全基于 Git 和 Ruby,所以自由修改的同时你仍可以轻松撤销你的变更或与上游更新合并。
- Homebrew 的配方都是简单的 Ruby 脚本;
- Homebrew 使 macOS(或您的 Linux 系统)更完整。使用
gem
来安装 RubyGems、用brew
来安装那些依赖包。 - “要安装,请拖动此图标......”不会再出现了。使用
brew cask
安装 macOS 应用程序、字体和插件以及其他非开源软件。 - 制作一个 cask 就像创建一个配方一样简单。
1.3 Homebrew 简单命令
brew --version
brew command[ --verbose| -v] [ options] [ formula]…# Homebrew 安装依赖目录
$ /usr/local/Cellar/# Homebrew 安装第三方包
$ brew install gnuplot# Homebrew 查询第三方包
$ brew search gnuplot# Homebrew 列举本地机器上已安装的包
$ brew list# Homebrew 卸载第三方包
$ brew uninstall gnuplot
具体各个命令细则,请参考如下 地址:
https://docs.brew.sh/Manpage
二. 安装
2.1 WSL 安装
以下安装环境用的是Windows Sub Linux(Ubuntu 18.04 LTS) ,Mac/Linux 安装过程一样的;
继续,
坐等下载 57M 左右的资源...这个过程我等了好久...
网络连接断了,然后继续执行如下语句,重走这个安装过程,
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
然后继续等...
# 首次安装系统后,应执行如下语句
$ sudo apt update
然后继续等...
2.2 切换源
然后你会发现巨慢,算了,直接切换清华源吧
参考如下地址:
https://mirror.tuna.tsinghua.edu.cn/help/homebrew/
下载 https://raw.githubusercontent.com/Homebrew/install/master/install.sh 文件命令到本地:
curl https://raw.githubusercontent.com/Homebrew/install/master/install.sh -o install.sh --progress
如果无法下载,或者遇到443 问题,那就直接浏览器中访问https://raw.githubusercontent.com/Homebrew/install/master/install.sh 地址,全选复制保存到新建的 install.sh 文件中;
下载完,修改文件权限,编辑文件,如下命令:
$ ls -al
$ chmod 777 install.sh
$ vim install.sh
修改内容如下:
BREW_REPO="https://github.com/Homebrew/brew"
# 变成:
BREW_REPO="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
如下图所示:
接着,运行 install.sh
以安装 Homebrew:
HOMEBREW_CORE_GIT_REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git bash install.sh
刚才过程,我走失败了,我重新运行一下,换成国内源后,真香,
2.3 配置环境变量
注意到如下所示:
方式一(推荐):
Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.
==> Installation successful!==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:https://docs.brew.sh/Analytics
No analytics data has been sent yet (or will be during this `install` run).==> Homebrew is run entirely by unpaid volunteers. Please consider donating:https://github.com/Homebrew/brew#donations==> Next steps:
- Run `brew help` to get started
- Further documentation:https://docs.brew.sh
- Install the Homebrew dependencies if you have sudo access:sudo apt-get install build-essentialSee https://docs.brew.sh/linux for more information
- Add Homebrew to your PATH in /home/xxx/.profile:echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> /home/xxx/.profileeval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
- We recommend that you install GCC:brew install gcc
编辑.profile 文件,
xxx@DESKTOP-XXX:~$ ls -al
total 84
drwxr-xr-x 1 xxx xxx 4096 Sep 4 22:06 .
drwxr-xr-x 1 root root 4096 Sep 4 22:06 ..
-rw------- 1 xxx xxx 823 Sep 4 21:59 .bash_history
-rw-r--r-- 1 xxx xxx 220 Sep 4 21:32 .bash_logout
-rw-r--r-- 1 xxx xxx 3771 Sep 4 21:32 .bashrc
drwxrwxrwx 1 xxx xxx 4096 Sep 4 22:06 .cache
drwxr-xr-x 1 xxx xxx 4096 Sep 4 21:32 .landscape
-rw-rw-rw- 1 xxx xxx 0 Sep 4 21:32 .motd_shown
-rw-r--r-- 1 xxx xxx 807 Sep 4 21:32 .profile // 此处文件
-rw-r--r-- 1 xxx xxx 0 Sep 4 21:42 .sudo_as_admin_successful
-rw------- 1 xxx xxx 2394 Sep 4 22:06 .viminfo
-rw-rw-rw- 1 xxx xxx 4004 Sep 4 21:53 apt_list_pkg_upgradable.log
-rwxr-xr-x 1 xxx xxx 33966 Sep 4 22:06 install.sh
添加如下 语句
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
即,
执行如下命令,更新环境变量
source .profile
方式二:
编辑.bashrc 文件,
添加如下 语句
export LINUX_BREW_HOME=/home/linuxbrew/.linuxbrew
export PATH=$LINUX_BREW_HOME/bin:$PATH
即,
执行如下命令,更新环境变量
source .bashrc
即,
如果一切都没啥问题的话,执行如下命令:
brew --version
如下所示:
表示,安装成功;
2.4 恢复源(可选)
不推荐,国内源相对来说比较快捷,除非万不得已,信息源落后官方源才恢复源去更新;
目前源为清华源:
执行如下命令:
# brew 程序本身,Homebrew/Linuxbrew 相同
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git# 以下针对 Linux 系统上的 Linuxbrew
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/linuxbrew-core.git## 如果是Mac 请使用如下
# 以下针对 mac OS 系统上的 Homebrew
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
git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
git -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git
如下所示:
使用如下命令,验证一下:
$ brew update
Already up-to-date.
如果没啥问题,应该是最新的;
三. 参考
- https://brew.sh/index_zh-cn
- https://github.com/Homebrew/brew
- https://docs.brew.sh/Formula-Cookbook#homebrew-terminology
- https://formulae.brew.sh/
- https://formulae.brew.sh/formula/
- https://docs.brew.sh/
- https://docs.brew.sh/Installation
- https://docs.brew.sh/Manpage
- https://docs.brew.sh/Troubleshooting
- https://mirror.tuna.tsinghua.edu.cn/help/homebrew/
- https://askubuntu.com/questions/759880/where-is-the-ubuntu-file-system-root-directory-in-windows-subsystem-for-linux-an
(完)
【Homebrew】Homebrew 介绍与安装相关推荐
- [note] Homebrew的介绍、安装方法与常用命令整理
Homebrew介绍: Homebrew是Mac下一款软件包管理器(软件包管理系统:在计算机中自动安装.配置.卸载和升级软件包的工具组合),可以简化macOS上软件的安装管理过程.Homebrew C ...
- MAC: Homebrew(代替yum)安装
安装 ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" 最新方式请参见 ...
- homebrew php70,OSX下安装PHP7教程详解
内容概要 1.安装homebrew 2.通过homebrew安装php7 3.配置apache文件 4.重启apache 安装homebrew homebrew是OSX下的最好的包管理软件(没有之一) ...
- MAC Homebrew国内如何自动安装(国内地址)
Homebrew国内如何自动安装(国内地址) 一.自动脚本(全部国内地址)(在Mac os终端中复制粘贴回车下面这句话) /bin/zsh -c "$(curl -fsSL https:// ...
- Scrapy-Splash的介绍、安装以及实例
scrapy-splash的介绍 在前面的博客中,我们已经见识到了Scrapy的强大之处.但是,Scrapy也有其不足之处,即Scrapy没有JS engine, 因此它无法爬取JavaScrip ...
- Springlake-01 介绍功能安装
Springlake-01 介绍&功能&安装 1. 简介与功能 1)Springlake 是一个企业内容平台SECP 2)是一个可配置的系统,80%内容可以配置 3)允许建立和配置垂直 ...
- Kafka系列一之架构介绍和安装
Kafka架构介绍和安装 写在前面 还是那句话,当你学习一个新的东西之前,你总得知道这个东西是什么?这个东西可以用来做什么?然后你才会去学习它,使用它.简单来说,kafka既是一个消息队列,如今,它也 ...
- SharpWebMail介绍和安装(转)
SharpWebMail介绍和安装 什么是:SharpWebMail SharpWebMail是一款C#开发的基于WEB应用程序的多语言的WEB邮件服务.它允许我们使用SMTP或IMAP服务来完成发送 ...
- Linux系统Vi/Vim编辑器的简单介绍、安装/卸载、常用命令
Linux系统Vi/Vim编辑器的简单介绍.安装/卸载.常用命令 1.介绍 vi(Visual Interface)编辑器是Linux和Unix上最基本的文本编辑器,工作在字符模式下.由于不需要图形界 ...
最新文章
- 物料需求计划评估和订单创建
- 操作多个表_2_组合相关的行
- 摄影技巧的种类之一 ——街拍技巧
- Python 并行编程
- Web应用与HTTP协议
- Silverlight AutoCompleteBox(自动完成输入框控件)使用方法
- OC 中property属性详解(assign , retain , copy , strong,weak,readonly , readwrite , atomic , nonatomic)
- IDEA中项目的两种打包方式
- 数字信号处理_巴特沃斯低通滤波器实验
- 软件密码模块安全要求
- 我花了一夜用数据结构给女朋友写个H5走迷宫游戏
- 现在做Android开发有前途吗?Android面试题及解析
- java程序模拟手机
- 鼠标移入或悬浮禁用图标,点击事件不生效
- 讲的真详细!花三分钟看完这篇文章你就懂了
- 惠普战66 三代 pro win10下安装ubuntu20.04
- STM32CubeMX学习--ThreadX_UART
- i.mx6 lvds接口的DE模式液晶屏驱动调试
- jav音频格式转换 ffmpeg 微信录音amr转mp3
- 搭建AppRTC服务器 (AppRTC+Collider+Coturn) 2019
热门文章
- 看网页视频如何自定义倍速(b站举例)
- 表单ajax提交插件,详解javascript表单的Ajax提交插件的使用
- Linux:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cann
- 阿里云ClickHouse海量数据分析
- 讲讲React中的State和Props
- 哨兵二号数据offline_科学网—利用ENVI 5.3读取哨兵2号(Sentinel-2)L1C数据 - 朱永超的博文...
- 【评测】一种组织蛋白快速提取方法
- ubanutu 安装php,腾讯的这个JS幻灯太难扣了,求高人指点。。。_html/css_WEB-ITnose
- gitlab邮件发不出去解决方法
- VSCode 如何设置启动时打开上次关闭时在编辑的文件