macOS 下安装brew、nvm

1、brew:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

brew -v 查看版本

示例: 安装jdk

brew search  jdk

查询可用的jdk版本

brew install openjdk@11

安装制定版本jdk

更换源:例如清华源

# 替换默认源:
    $ cd "$(brew --repo)"
    $ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
    
    # 替换bottles源:
    $ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    $ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
    
    # 更新Brew:
    $ brew update

2、nvm

brew install nvm 

查询是否已经安装: nvm --version

错误: zsh: command not found: nvm

解决:


目录: mkdir ~/.nvm


配置文件: ~/。bash_profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion



复制:  . "/usr/local/opt/nvm/nvm.sh"  将nvm.sh复制到可执行目录下


执行: source ~/。bash_profile

你可能感兴趣的:(macos)