mirror of
https://gitee.com/ineo6/homebrew-install.git
synced 2025-09-26 22:09:57 +08:00
feat: 恢复bottles镜像设置
This commit is contained in:
parent
ee193c827f
commit
a0362348b0
@ -73,6 +73,22 @@ const SourceGenerate = ({ first }) => {
|
||||
|
||||
shellArray.push('brew update');
|
||||
|
||||
shellArray.push('');
|
||||
|
||||
const file = terminalType === 'zsh' ? '.zprofile' : '.bash_profile';
|
||||
|
||||
if (platform === Platform.Linux && matchMirror.linuxBottles) {
|
||||
shellArray.push(
|
||||
`echo 'export HOMEBREW_BOTTLE_DOMAIN=${matchMirror.linuxBottles}' >> ~/${file}`,
|
||||
);
|
||||
} else {
|
||||
shellArray.push(
|
||||
`echo 'export HOMEBREW_BOTTLE_DOMAIN=${matchMirror.bottles}' >> ~/${file}`,
|
||||
);
|
||||
}
|
||||
|
||||
shellArray.push(`source ~/${file}`);
|
||||
|
||||
return shellArray.join('\n');
|
||||
}
|
||||
|
||||
@ -95,6 +111,23 @@ const SourceGenerate = ({ first }) => {
|
||||
'/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"',
|
||||
);
|
||||
|
||||
shellArray.push('');
|
||||
shellArray.push('# 2.安装完成后设置');
|
||||
|
||||
const file = terminalType === 'zsh' ? '.zprofile' : '.bash_profile';
|
||||
|
||||
if (platform === Platform.Linux && matchMirror.linuxBottles) {
|
||||
shellArray.push(
|
||||
`echo 'export HOMEBREW_BOTTLE_DOMAIN=${matchMirror.linuxBottles}' >> ~/${file}`,
|
||||
);
|
||||
} else {
|
||||
shellArray.push(
|
||||
`echo 'export HOMEBREW_BOTTLE_DOMAIN=${matchMirror.bottles}' >> ~/${file}`,
|
||||
);
|
||||
}
|
||||
|
||||
shellArray.push(`source ~/${file}`);
|
||||
|
||||
return shellArray.join('\n');
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ export const tencentMirror = {
|
||||
core: 'https://mirrors.cloud.tencent.com/homebrew/homebrew-core.git',
|
||||
linuxCore: 'https://mirrors.cloud.tencent.com/homebrew/linuxbrew-core.git',
|
||||
cask: 'https://mirrors.cloud.tencent.com/homebrew/homebrew-cask.git',
|
||||
bottles: 'https://mirrors.cloud.tencent.com/homebrew-bottles/bottles',
|
||||
bottles: 'https://mirrors.cloud.tencent.com/homebrew-bottles/bottles/',
|
||||
linuxBottles: '',
|
||||
};
|
||||
|
||||
@ -13,8 +13,9 @@ export const tsinghuaMirror = {
|
||||
linuxCore:
|
||||
'https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/linuxbrew-core.git',
|
||||
cask: 'https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git',
|
||||
bottles: 'https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles',
|
||||
linuxBottles: 'https://mirrors.tuna.tsinghua.edu.cn/linuxbrew-bottles',
|
||||
bottles: 'https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/',
|
||||
linuxBottles:
|
||||
'https://mirrors.tuna.tsinghua.edu.cn/linuxbrew-bottles/bottles/',
|
||||
};
|
||||
|
||||
export const ustcMirror = {
|
||||
@ -22,8 +23,8 @@ export const ustcMirror = {
|
||||
core: 'https://mirrors.ustc.edu.cn/homebrew-core.git',
|
||||
linuxCore: 'https://mirrors.ustc.edu.cn/linuxbrew-core.git',
|
||||
cask: 'https://mirrors.ustc.edu.cn/homebrew-cask.git',
|
||||
bottles: 'https://mirrors.ustc.edu.cn/homebrew-bottles',
|
||||
linuxBottles: 'https://mirrors.ustc.edu.cn/linuxbrew-bottles',
|
||||
bottles: 'https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/',
|
||||
linuxBottles: 'https://mirrors.ustc.edu.cn/linuxbrew-bottles/bottles/',
|
||||
};
|
||||
|
||||
export const bfsuMirror = {
|
||||
@ -31,8 +32,8 @@ export const bfsuMirror = {
|
||||
core: 'https://mirrors.bfsu.edu.cn/git/homebrew/homebrew-core.git',
|
||||
linuxCore: 'https://mirrors.bfsu.edu.cn/git/homebrew/linuxbrew-core.git',
|
||||
cask: 'https://mirrors.bfsu.edu.cn/git/homebrew/homebrew-cask.git',
|
||||
bottles: 'https://mirrors.bfsu.edu.cn/homebrew-bottles',
|
||||
linuxBottles: 'https://mirrors.bfsu.edu.cn/linuxbrew-bottles',
|
||||
bottles: 'https://mirrors.bfsu.edu.cn/homebrew-bottles/bottles/',
|
||||
linuxBottles: 'https://mirrors.bfsu.edu.cn/linuxbrew-bottles/bottles/',
|
||||
};
|
||||
|
||||
export const mirrorData: { [key: string]: any } = {
|
||||
|
@ -68,7 +68,7 @@ alias ibrew='arch -x86_64 /usr/local/bin/brew'
|
||||
|
||||
## 设置镜像
|
||||
|
||||
**注意:本文中的安装脚本会设置中科大源镜像,如果你也想设置`cask`的镜像,请按下面注释部分选择执行代码。**
|
||||
**注意:本文中的安装脚本会设置中科大源镜像,如果你也想设置`cask`和`bottles`的镜像,请按下面注释部分选择执行代码。**
|
||||
|
||||
更详细的教程可以参考前面的文章:[设置镜像](/guide/start/#part3) 。
|
||||
|
||||
@ -85,6 +85,14 @@ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc
|
||||
|
||||
# cask
|
||||
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
|
||||
|
||||
# bottles for zsh 和下面2选1
|
||||
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
|
||||
source ~/.zprofile
|
||||
|
||||
# bottles for bash 和上面2选1
|
||||
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.bash_profile
|
||||
source ~/.bash_profile
|
||||
```
|
||||
|
||||
**如果觉得教程有用,欢迎多多分享宣传~**
|
||||
|
@ -77,6 +77,33 @@ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna
|
||||
brew update
|
||||
```
|
||||
|
||||
### 设置 bottles 镜像
|
||||
|
||||
设置环境变量需要注意终端的类型,可以先通过以下方式获取:
|
||||
|
||||
执行命令`echo $SHELL`,根据结果判断:
|
||||
|
||||
- `/bin/zsh` => `zsh` => `.zprofile`
|
||||
- `/bin/bash` => `bash` => `.bash_profile`
|
||||
|
||||
然后继续正式操作,以**中科大源**为例:
|
||||
|
||||
从`macOS Catalina`(10.15.x) 版开始,`Mac`使用`zsh`作为默认`Shell`,对应文件是`.zprofile`,所以命令为:
|
||||
|
||||
```shell
|
||||
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
|
||||
source ~/.zprofile
|
||||
```
|
||||
|
||||
如果是`macOS Mojave` 及更低版本,并且没有自己配置过`zsh`,对应文件则是`.bash_profile`:
|
||||
|
||||
```shell
|
||||
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.bash_profile
|
||||
source ~/.bash_profile
|
||||
```
|
||||
|
||||
> 注意:上述区别仅仅是`.zprofile`和`.bash_profile`不同,上下文如有再次提及编辑`.zprofile`,均按此方法判断具体操作的文件。
|
||||
|
||||
至此,安装和设置操作都完成了。
|
||||
|
||||
### 恢复默认源
|
||||
@ -91,6 +118,8 @@ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/H
|
||||
brew update
|
||||
```
|
||||
|
||||
`homebrew-bottles`配置只能手动删除,将 `~/.zprofile` 文件中的 `HOMEBREW_BOTTLE_DOMAIN=https://mirrors.xxx.com`内容删除,并执行 `source ~/.zprofile`。
|
||||
|
||||
## 如何卸载 Homebrew
|
||||
|
||||
使用官方脚本同样会遇到`uninstall`地址无法访问问题,可以使用下面脚本:
|
||||
|
Loading…
x
Reference in New Issue
Block a user