hosts基础修改:
13.249.146.118 d3mw3wlkjdkqc9.cloudfront.net fastdl.mongodb.org
13.249.146.66 www.mongodb.org
199.232.68.133 raw.githubusercontent.com
13.249.146.118 d3mw3wlkjdkqc9.cloudfront.net fastdl.mongodb.org
185.199.110.154 githubassets.com
13.229.188.59 github.com
140.82.114.3 github.com
185.199.109.153 github.io
以上修改是为了 防止域名解析混淆,在安装Homebrew等时可以直接访问,下载MongoDB时可以更快下载。
可以通过 ipaddress 网站查询对应域名的IP地址。
安装Homebrew:
安装命令:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# 替换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
重置源:
重置brew.git:
$ cd "$(brew --repo)"
$ git remote set-url origin https://github.com/Homebrew/brew.git
重置homebrew-core.git:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://github.com/Homebrew/homebrew-core.git
应用生效:
$ brew update
安装zsh
mac自带zsh
,但不是最新的,查看版本zsh --version
通过brew
更新最新版,brew install zsh
安装oh-my-zsh
# 安装
1. sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# 查看当前shell
2. echo $SHELL
# 设置zsh为默认终端
3. chsh -s /bin/zsh
# 安装完成后会自带一些主题,也可以去下面的地址下载主题放到 ~/.oh-my-zsh/themes 下
4. https://github.com/robbyrussell/oh-my-zsh/wiki/themes
修改主题
1. 打开配置文件:open ~/.zshrc
2. 修改配置文件:ZSH_THEME=你想要的主题,默认为robbyrussell
3. 让配置文件生效:source ~/.zshrc
4. 主题推荐:ys,ys是安装时自带的,无需额外下载
自动补全插件
$ git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
命令高亮插件
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
配置插件
$ vim ~/.zshrc
## 找到 plugins=(git) 按如下修改,增加刚下载的两个插件
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
# 刷新环境变量
$ source ~/.zshrc
# 主题
$ git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
$ vi ~/.zshrc
## 修改如下
export TERM="xterm-256color"
ZSH_THEME="powerlevel9k/powerlevel9k"
安装ruby
首先安装RVM
,RVM 是一个便捷的多版本 Ruby 环境的管理和切换工具
$ curl -sSL https://get.rvm.io | bash -s stable
更新RVM
$ rvm get stable
安装ruby
列出所有可安装的ruby 命令:rvm list known
安装一个ruby
$ rvm install 2.6 --default
检查ruby版本:
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin19]
安装sass
查看gem版本 命令:gem --version
$ sudo gem install sass