Brew 笔记
2020-04-05 23:18:28 10 举报
AI智能生成
Brew 笔记
作者其他创作
大纲/内容
更换国内源
中国科大开源软件镜像站
替换Homebrew源
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
替换homebrew-core源
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换homebrew-cask源
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
替换Homebrew-bottles源
bash
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
zsh
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
清华大学开源软件镜像站
替换Homebrew源
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
替换homebrew-core源
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
替换homebrew-cask源
替换Homebrew-bottles源
bash
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
阿里云官方镜像站
替换Homebrew源
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
替换homebrew-core源
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
替换homebrew-cask源
替换Homebrew-bottles源
bash
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
zsh
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
腾讯软件源站
替换Homebrew源
cd "$(brew --repo)"
git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/brew.git
替换homebrew-core源
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/homebrew-core.git
替换homebrew-cask源
替换Homebrew-bottles源
bash
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.cloud.tencent.com/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
zsh
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.cloud.tencent.com/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
官方默认源
替换Homebrew源
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
替换homebrew-core源
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
替换homebrew-cask源
cd "$(brew --repo)"/Library/Taps/caskroom/homebrew-cask
git remote set-url origin https://github.com/Homebrew/homebrew-cask
替换Homebrew-bottles源
删除HOMEBREW_BOTTLE_DOMAIN环境变量
brew 目录结构
/usr/local/
Caskroom
app文件
Cellar
所有brew安装的程序,都将以 [程序名/版本号] 存放于本目录下
Frameworks
Homebrew
brew程序所在路径,正如你所见的是git的maste分支
brew程序自身命令集
bin
用于存放所安装程充的启动链接(相当于快捷方式)
etc
brew安装程序的配置文件默认存放路径
include
lib
opt
由于版本号随着跟新而改变的,所以需要一个固定不变的路径作为我们访问二进制和文档的路径
存一份Celler内文件的软连接,没有版本号
sbin
系统级别的软件安装目录
share
所有包安装之后的文档都会链接到这个路径下
var
${HOME}/Library/Caches/Homebrew
homebrew要安装的文件默认是下载这个目录里面
可以将源程序文件下载到这里,然后再运行brew install ,会被提示到文件已存在于/Library/Caches/Homebrew目录中,然后就会直接安装。
常用软件包
Java
Oracle JDK
brew cask install oracle-jdk
最新版
Oracle 规定在一个 Oracle JDK 的生命周期内 (指的是下一个版本的 JDK 推出之前) 可以免费商用, 而生命周期之外继续在生产环境中使用, 想要继续商用 Oracle 对该版本的后续更新就需要付费
Oracle OpenJDK
brew cask install java
最新版
brew cask install java11
brew cask install java8
AdoptOpenJDK
brew cask install adoptopenjdk
最新版
brew cask install adoptopenjdk11
或
brew cask install AdoptOpenJDK/openjdk/adoptopenjdk11
brew cask install homebrew/cask-versions/adoptopenjdk11
brew cask install adoptopenjdk8
或
brew cask install AdoptOpenJDK/openjdk/adoptopenjdk8
brew cask install homebrew/cask-versions/adoptopenjdk8
brew cask info homebrew/cask-versions/adoptopenjdk8
Java 安装后的HOME路径
/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/
Java 多版本切换
jenv
激活jenv,需要在profile中追加配置
~/.bash_profile
或
~/.zshrc
或
~/.zshrc
# jenv begin >>
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
# jenv end <<
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
# jenv end <<
source ~/.bash_profile
或
source ~/.zshrc
或
source ~/.zshrc
将现有的jdk添加到jenv管理
jenv add /Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home
查看现有的版本
jenv versions
切换java版本
jenv local jdk11
设置全局
jenv global jdk11
Java检查
jenv doctor
0 条评论
下一页