使用 Curl 卸载 Amplify CLI

Uninstall Amplify CLI with Curl

我已经安装了带有 curl 和 npm 的 Amplify CLI,我要保留一个,所以我卸载 curl 只是因为在我个人的情况下 npm 对我来说更容易更新,这是我用来安装它的命令:

curl -sL https://aws-amplify.github.io/amplify-cli/install | bash && $SHELL

如何卸载它?我正在使用 macOS

谢谢

你必须手动清理,在我看来这并不难。

二进制文件位于 $HOME/.amplify/bin/amplify。然后,根据您的 shell,您可以删除 installation script 添加的自定义路径和配置。

# Add to $PATH
SOURCE_STR="# Added by Amplify CLI binary installer\nexport PATH=\"$HOME/.amplify/bin:$PATH\"\n"
add_to_path () {
  command printf "\n$SOURCE_STR" >> ""
  printf "\n$yellow Added the following to :\n\n$SOURCE_STR$reset"
}
SHELLTYPE="$(basename "/$SHELL")"
if [[ $SHELLTYPE = "fish" ]]; then
  command fish -c 'set -U fish_user_paths ~/.amplify/bin $fish_user_paths'
  printf "\n$yellow Added ~/.amplify/bin to fish_user_paths universal variable$reset."
elif [[ $SHELLTYPE = "zsh" ]]; then
  SHELL_CONFIG=$HOME/.zshrc
  if [ ! -r $SHELL_CONFIG ] || (! `grep -q '.amplify/bin' $SHELL_CONFIG`); then
    add_to_path $SHELL_CONFIG
  fi
else
  SHELL_CONFIG=$HOME/.bashrc
  if [ ! -r $SHELL_CONFIG ] || (! `grep -q '.amplify/bin' $SHELL_CONFIG`); then
    add_to_path $SHELL_CONFIG
  fi
  SHELL_CONFIG=$HOME/.bash_profile
  if [[ -r $SHELL_CONFIG ]]; then
    if [[ ! $(grep -q '.amplify/bin' $SHELL_CONFIG) ]]; then
      add_to_path $SHELL_CONFIG
    fi
  else
    SHELL_CONFIG=$HOME/.bash_login
    if [[ -r $SHELL_CONFIG ]]; then
      if [[ ! $(grep -q '.amplify/bin' $SHELL_CONFIG) ]]; then
        add_to_path $SHELL_CONFIG
      fi
    else
      SHELL_CONFIG=$HOME/.profile
      if [ ! -r $SHELL_CONFIG ] || (! `grep -q '.amplify/bin' $SHELL_CONFIG`); then
        add_to_path $SHELL_CONFIG
      fi
    fi
  fi
fi