# macOS Init Guide

- Link: https://www.ixiqin.com/2019/05/01/macos-init-guide/
- Published: 2019-05-01T22:24:56+08:00
- Author: 白宦成

文章目录

 [Toggle](https://www.ixiqin.com/2019/05/01/macos-init-guide/#)

 * [homebrew](https://www.ixiqin.com/2019/05/01/macos-init-guide/#homebrew)
 * [homebrew source](https://www.ixiqin.com/2019/05/01/macos-init-guide/#homebrew_source)
 * [iTerm 2](https://www.ixiqin.com/2019/05/01/macos-init-guide/#iterm_2)
 * [zsh](https://www.ixiqin.com/2019/05/01/macos-init-guide/#zsh)
 * [OhMyZsh](https://www.ixiqin.com/2019/05/01/macos-init-guide/#ohmyzsh)
 * [zsh-sytax-highlighting](https://www.ixiqin.com/2019/05/01/macos-init-guide/#zsh-sytax-highlighting)
 * [powerline](https://www.ixiqin.com/2019/05/01/macos-init-guide/#powerline)
 * [sublime text 3](https://www.ixiqin.com/2019/05/01/macos-init-guide/#sublime_text_3)
 * [autojump](https://www.ixiqin.com/2019/05/01/macos-init-guide/#autojump)
 * [nvm (Node.js 环境管理)](https://www.ixiqin.com/2019/05/01/macos-init-guide/#nvm_nodejs_%e7%8e%af%e5%a2%83%e7%ae%a1%e7%90%86)
 * [nrm(Node.js Mirro 管理)](https://www.ixiqin.com/2019/05/01/macos-init-guide/#nrmnodejs_mirro_%e7%ae%a1%e7%90%86)
 * [PyEnv(Python 环境管理)](https://www.ixiqin.com/2019/05/01/macos-init-guide/#pyenvpython_%e7%8e%af%e5%a2%83%e7%ae%a1%e7%90%86)
 * [rbEnv](https://www.ixiqin.com/2019/05/01/macos-init-guide/#rbenv)
 * [常用软件](https://www.ixiqin.com/2019/05/01/macos-init-guide/#%e5%b8%b8%e7%94%a8%e8%bd%af%e4%bb%b6)

## homebrew

    ```javascript
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    Code language: JavaScript (javascript)
    ```

## homebrew source

    ```php
    cd "$(brew --repo)"
    git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
    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 update
    brew install caskroom/cask/brew-cask 
    Code language: PHP (php)
    ```

## iTerm 2

    ```shcb-line-numbers
    brew cask install iterm2
    ```

## zsh

    ```shcb-line-numbers
    brew install zsh zsh-completions
    ```

## OhMyZsh

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

## zsh-sytax-highlighting

    ```shcb-line-numbers
    brew install zsh-syntax-highlighting
    ```

    ```shcb-line-numbers
    source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    ```

## powerline

    ```php
    # clone
    git clone https://github.com/powerline/fonts.git --depth=1
    # install
    cd fonts
    ./install.sh
    # clean-up a bit
    cd ..
    rm -rf fonts
    Code language: PHP (php)
    ```

## sublime text 3

    ```shcb-line-numbers
    brew cask install sublime-text
    ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
    ```

## autojump

    ```shcb-line-numbers
    brew install autojump
    ```

然后将下面这段代码加入 shell 的配置文件中,比如`.bashrc` 或 `.zhsrc` 中.

    ```shcb-line-numbers
    [ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
    ```

## nvm (Node.js 环境管理)

    ```php
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
    nvm install node
    nvm use node
    Code language: PHP (php)
    ```

## nrm(Node.js Mirro 管理)

    ```php
    npm install nrm -g --save
    nrm use taobao
    Code language: PHP (php)
    ```

## PyEnv(Python 环境管理)

    ```javascript
    curl https://pyenv.run | bash
    Pyenv install 3.7.3
    Code language: JavaScript (javascript)
    ```

    ```javascript
    export PATH="/Users/bestony/.pyenv/bin:$PATH"
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
    Code language: JavaScript (javascript)
    ```

## rbEnv

    ```shcb-line-numbers
    brew install rbenv
    ```

    ```javascript
    eval "$(rbenv init -)"
    Code language: JavaScript (javascript)
    ```

## 常用软件

    ```shcb-line-numbers
    brew cask install 1password sublime-text google-chrome
    ```
