MAC环境变量
# 前2个是系统级别的,其余按从上到下的顺序加载。
# .bashrc没有上述规则,它是bash shell打开的时候加载的。
/etc/profile
/etc/paths
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc
# 如果文件readonly
sudo chmod a+rwx /etc/profile
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:789
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Homebrew源替换
# 替换brew.git:
cd "$(brew --repo)"
# 中科大:
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 清华:
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
# 中科大:
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 清华:
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 替换homebrew-bottles:
# 中科大:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 清华:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 应用
brew update
# 还原官方源
unset HOMEBREW_BREW_GIT_REMOTE
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew
Mac OpenJDK安装
# 更新源
brew tap AdoptOpenJDK/openjdk
# 查找安装包
brew search /adoptopenjdk
==> Casks
adoptopenjdk10 adoptopenjdk12-openj9-jre-large adoptopenjdk14-openj9-jre
adoptopenjdk11 adoptopenjdk12-openj9-large adoptopenjdk14-openj9-jre-large
adoptopenjdk11-jre adoptopenjdk13 adoptopenjdk14-openj9-large
adoptopenjdk11-openj9 adoptopenjdk13-jre adoptopenjdk8
adoptopenjdk11-openj9-jre adoptopenjdk13-openj9 adoptopenjdk8-jre
adoptopenjdk11-openj9-jre-large adoptopenjdk13-openj9-jre adoptopenjdk8-openj9
adoptopenjdk11-openj9-large adoptopenjdk13-openj9-jre-large adoptopenjdk8-openj9-jre
adoptopenjdk12 adoptopenjdk13-openj9-large adoptopenjdk8-openj9-jre-large
adoptopenjdk12-jre adoptopenjdk14 adoptopenjdk8-openj9-large
adoptopenjdk12-openj9 adoptopenjdk14-jre adoptopenjdk9
adoptopenjdk12-openj9-jre adoptopenjdk14-openj9 homebrew/cask/adoptopenjdk
# 选择一个进行安装
brew cask install adoptopenjdk11
环境变量
export PATH=/Users/devlgq/Applications/flutter/bin:$PATH
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
配置Terminal
# 安装powerline
pip3 install powerline-status --user
# 安装pip
sudo easy_install pip
# 查看安装目录
pip3 show powerline-status
# 卸载
pip3 uninstall powerline-status
# /Library/Python/3.7/site-packages
# 添加启动脚本
. /Library/Python/3.7/site-packages/powerline/bindings/bash/powerline.sh
# curl 安装方式
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# wget 安装方式
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
# 提示zsh: command not found: wget
brew install wget
# 切换回默认终端
chsh -s /bin/zsh
# 安装PowerFonts
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
# 导入配色
git clone https://github.com/altercation/solarized
# 导入主题
git clone https://github.com/fcamblor/oh-my-zsh-agnoster-fcamblor
# 安装主题
cd oh-my-zsh-agnoster-fcamblor
./install
# 编辑~/.zshrc文件,将ZSH_THEME改为agnoster
vim ~/.zshrc
# 添加高亮效果
git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
# 编辑 .zshrc 添加
source ~/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
plugins=(
git
zsh-syntax-highlighting
)
# 可选择、命令补全
cd ~/.oh-my-zsh/custom/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions
vi ~/.zshrc
source ~/.oh-my-zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
# 安装 Powerlevel10k 主题
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
# ~/.zshrc 中设置 ZSH_THEME=powerlevel10k/powerlevel10k