hosts根底批改:

批改hosts文件能够应用 SwitchHosts

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:

装置命令:

上面这种装置形式下载会很慢很慢,能够应用下面提到的批改hosts办法批改相干用到的域名的IP指向减速下载。

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

替换brew默认源为国内源:

# 替换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

简略应用:

搜寻:brew search
装置:brew install 软件名
卸载:brew remove 软件名

装置wget

应用homebrew装置

$ brew install wget

装置zsh

mac自带zsh,但不是最新的,查看版本zsh --version
通过brew更新最新版,brew install zsh

装置oh-my-zsh

装置

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

查看以后shell

echo $SHELL

设置zsh为默认终端

chsh -s /bin/zsh

批改主题

装置实现后会自带一些主题,能够到 ~/.oh-my-zsh/themes 目录下查看能够应用的主题。

也能够通过上面的地址下载主题放到 ~/.oh-my-zsh/themes

https://github.com/robbyrusse...

批改主题

1. 关上配置文件:open ~/.zshrc2. 批改配置文件:ZSH_THEME=你想要的主题,默认为robbyrussell3. 让配置文件失效:source ~/.zshrc4. 主题举荐:ys,ys是装置时自带的,无需额定下载

主动补全插件

执行以下命令装置插件,插件会被装置到 ~/.oh-my-zsh/custom/plugins 目录下:

$ git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions

批改 .zshrc 配置:

1. 编辑 vim .zshrc2. 找到 `plugins=(git)` 这一行并减少plugins=(git zsh-autosuggestions)3. 从新加载配置 source .zshrc

命令高亮插件

装置:

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting

批改 .zshrc 配置:

1. 编辑 vim .zshrc2. 找到 `plugins=(git)` 这一行并减少plugins=(git zsh-syntax-highlighting)3. 从新加载配置 source .zshrc

装置ruby

装置RVM

首先装置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 -vruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin19]

装置sass

查看gem版本

$ gem --version

装置sass

$ sudo gem install sass