# mac系统安装 --- ## Homebrew Install 通过命令行安装homebrew,然后安装下常用的命令行工具 ``` xcode-select --install /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install wget curl telnet vim cmake autoconf ``` ## Items2 Install 更换命令行终端,这个比较好用,新版本macos 10.15内置了 ``` brew cask install iterm2 ## 安装oh my zsh sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ## 切换为默认shell chsh -s /bin/zsh ## 可以修改主题 "robbyrussell" "agnoster" vim ~/.zshrc ZSH_THEME="robbyrussell" ## 下载字体文件 ``` [Meslo font](https://github.com/powerline/fonts/blob/master/Meslo%20Slashed/Meslo%20LG%20M%20Regular%20for%20Powerline.ttf) ``` ## 安装iterm2插件 git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions brew install zsh-syntax-highlighting git clone git://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ## 修改安装配置文件.zshrc vim ~/.zshrc ### 修改 plugins=(git zsh-autosuggestions zsh-syntax-highlighting) ### 最后一行添加 source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ### 设置代理 alias my.http='export all_proxy=socks5://127.0.0.1:1086' alias my.un='unset all_proxy' alias my.ip="~/.ip.sh" ### 设置go环境变量 export GOPATH=$HOME/go export GOROOT=/usr/local/opt/go/libexec export PATH=$PATH:$GOPATH/bin:$GOROOT/bin ### 因为一些众所周知的原因,在国内无法访问 golang.org,自然也就无法下载在其下的资源。这时我们可以设置 $GOPROXY来解决这个问题。设置$GOPROXY 其实就是设置一个代理帮你去访问和安装这些包,而不是通过你自己的网络。 ### 可选go proxy export GOPROXY="https://goproxy.io" export GOPROXY="https://goproxyus.herokuapp.com" export GOPROXY="https://goproxy.cn" ### 官方最新proxy export GOPROXY="https://proxy.golang.org" ### 设置vscode终端命令,使用vscode status查看检测 alias vscode="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code" ``` ## IP.SH ``` #!/bin/bash curl -s 'https://2021.ip138.com/' \ -H 'Connection: keep-alive' \ -H 'Upgrade-Insecure-Requests: 1' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36' \ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \ -H 'Sec-Fetch-Site: same-site' \ -H 'Sec-Fetch-Mode: navigate' \ -H 'Sec-Fetch-Dest: iframe' \ -H 'Referer: https://ip138.com/' \ -H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8' \ -H 'Cookie: Hm_lvt_f4f76646cd877e538aa1fbbdf351c548=1608860819; Hm_lpvt_f4f76646cd877e538aa1fbbdf351c548=1608860819' \ --compressed \ |grep iP| sed -e 's/<[^>]*>//g' ``` ## VSCode Install ``` ### go依赖包安装 直接通过在 vscode 上按 cmd+shift+p 弹出 vscode 的命令框,然后输入 >Go: Install/Update Tools 来安装这些依赖包了。 ### dlv安装 go get -u github.com/go-delve/delve/cmd/dlv cd $GOPATH/src/github.com/go-delve/delve make install ### 给dlv签名,通过证书签名助手创建一个系统代码签名证书 sudo codesign -s "gdb-dlv" $GOPATH/bin/dlv ``` ## VIM Install ``` ### 安装配置k-vim cd ~ git clone https://github.com/wklken/k-vim.git ### 配置k-vim需要的环境 brew install ctags brew install the_silver_searcher brew install python pip3 install flake8 yapf ### 需要JavaScript提示 brew install node npm config set registry "https://registry.npm.taobao.org" npm install jshint -g npm install jslint -g npm install -g eslint eslint-plugin-standard eslint-plugin-promise eslint-config-standard eslint-plugin-import eslint-plugin-node eslint-plugin-html babel-eslint ### 安装k-vim 进入目录, 执行安装 # 注意原先装过的童鞋, 重装时,不要到~/.vim下执行(这是软连接指向k-vim真是目录),必须到k-vim原生目录执行 # 会进入安装插件的列表,一安装是从github clone的,完全取决于网速, 之后会自动编译 YCM, 编译失败的话需要手动编译, 有问题见YCM文档 # 如果发现有插件安装失败 可以进入vim, 执行`:PlugInstall' cd ~/k-vim/bundle/YouCompleteMe git submodule update --init --recursive (速度慢成蜗牛) python install.py cd ~/k-vim sh -x install.sh ### 移除k-vim cd ~ && rm -rf .vim .vimrc .vimrc.bundles && cd - ``` RN+TS+MOBX Redis总结
No Leanote account? Sign up now.