Brew 笔记
2020-04-05 23:18:28 10 举报
AI智能生成
登录查看完整内容
Brew 笔记
作者其他创作
大纲/内容
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
清华大学开源软件镜像站
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
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
阿里云官方镜像站
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
腾讯软件源站
git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/brew.git
git remote set-url origin https://mirrors.cloud.tencent.com/homebrew/homebrew-core.git
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.cloud.tencent.com/homebrew-bottles' >> ~/.bash_profile
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.cloud.tencent.com/homebrew-bottles' >> ~/.zshrc
官方默认源
git remote set-url origin https://github.com/Homebrew/brew.git
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
cd \"$(brew --repo)\"/Library/Taps/caskroom/homebrew-cask
git remote set-url origin https://github.com/Homebrew/homebrew-cask
删除HOMEBREW_BOTTLE_DOMAIN环境变量
brew 目录结构
/usr/local/
Caskroom
app文件
Cellar
所有brew安装的程序,都将以 [程序名/版本号] 存放于本目录下
Frameworks
Homebrew
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 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
# jenv begin >>export PATH=\"$HOME/.jenv/bin:$PATH\" eval \"$(jenv init -)\"# jenv end <<
source ~/.bash_profile或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 条评论
回复 删除
下一页