备份

mkdir backup
cd backup

brew list > brew-liwt.txt
ls /Applications > Applications.txt

rsync -rR ~/.bash_profile ~/.config/clash ~/.docker/{config.json,daemon.json} ~/.gitconfig ~/.gitignore_global ~/.gradle/init.gradle ~/.jetbrains ~/.jetbrains.vmoptions.sh ~/.kube ~/.m2/settings.xml ~/.npmrc ~/.ssh ~/.yarnrc ~/.zshrc .

重装系统

  1. 重新启动
  2. 启动时按住Commond + R,直到出现
  3. 清理磁盘
  4. 重新安装系统

安装软件

export all_proxy=socks5://192.168.0.2:1080

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/liweitao/.zprofile\n    eval "$(/usr/local/bin/brew shellenv)"

brew update

brew install --cask google-chrome qq wechat balenaetcher redisinsight docker finalshell goland intellij-idea webstorm pycharm sublime-text sunloginclient iina telegram mailmaster microsoft-remote-desktop tunnelblick openvpn-connect neteasemusic netnewswire obsidian visual-studio-code wpsoffice-cn caffeine tabby bob

brew install nvm go hugo maven sqlite mvnvm git-lfs

git lfs install

sudo ln -sfn $HOMEBREW_PREFIX/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

nvm install v18.19.0

nvm use v18.19.0

npm install -g yarn

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

git clone https://github.com/zsh-users/zsh-completions $ZSH_CUSTOM:/plugins/zsh-completions

git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

p10k configure

.zshrc

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="powerlevel10k/powerlevel10k"

plugins=(
	git
	zsh-completions
	zsh-autosuggestions
	zsh-syntax-highlighting
)

source $ZSH/oh-my-zsh.sh

function proxy_clashx() {
  export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
}

function proxy_v2ray() {
  export http_proxy=http://127.0.0.1:1087
  export https_proxy=http://127.0.0.1:1087
  export all_proxy=socks5://127.0.0.1:1080
}

function unproxy() {
  unset {http,https,all}_proxy
}

function jdk_switch() {
  if [ "$1" = "" ]; then
    /usr/libexec/java_home -V
  else
    export JAVA_HOME=$(/usr/libexec/java_home -v $1)
  fi

  echo "Current JAVA_HOME:"
  echo "$JAVA_HOME"
}

# load zsh-completions
autoload -U compinit && compinit

# use starship theme (needs to be at the end)
eval "$(starship init zsh)"

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && \. "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/usr/local/opt/nvm/etc/bash_completion.d/nvm"  # This loads nvm bash_completion