mac环境搭建

378 阅读1分钟

mac环境搭建

Mac 每次都要执行source ~/.bash_profile 配置

自己在 ~/.bash_profile 中配置环境变量, 可是每次重启终端后配置的不生效.需要重新执行 : $source ~/.bash_profile

发现zsh加载的是 ~/.zshrc文件,而 ‘.zshrc’ 文件中并没有定义任务环境变量。

在~/.zshrc文件最后,增加一行: source ~/.bash_profile

HomeBrew国内安装

使用新的 Mac 电脑开发,没有安装 Homebrew 确实不行,但是国内访问 github,很不稳定,运行 /bin/bash -c "$(curl -fsSL raw.githubusercontent.com/Homebrew/in… 如下所示。

/bin/zsh -c "$(curl -fsSL gitee.com/cunkai/Home…)"

nvm 安装

brew install nvm

安装完成后,必须在你的 .bash_profile 加入以下这行,让你可以直接在shell使用nvm指令

source $(brew --prefix nvm)/nvm.sh

重新source你的 .bash_profile 来让设定生效

source ~/.bash_profile

~ 这个符号表示你的家目录, .bash_profile 是一个隐藏文件,主要是用来配置bash shell的, source ~/.bash_profile 就是让这个配置文件在修改后立即生效。