由于近期重装升级了新的系统macOS High Sierra,这里记录下系统配置和软件安装
系统配置
# 键盘长按支持
defaults write -g ApplePressAndHoldEnabled 0
# 修改系统截图位置
defaults write com.apple.screencapture location ~/Pictures/ScreenShots; killall SystemUIServer
安装命令行工具 参考
# open a dialog for installation of the command line developer tools
install-command-line-tools-mac-os-x/
xcode-select --install
设置代理,方便下载(如果有代理的话)
export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;
# 或者
export ALL_PROXY=socks5://127.0.0.1:1086
必备软件
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
安装brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install wget
安装brew第三方包Homebrew-Cask 不清楚Cask的可以看这里
brew tap caskroom/cask
brew tap caskroom/versions # 支持安装特定版本
安装Quick Look插件 参考
brew cask install qlcolorcode qlstephen qlimagesize webpquicklook suspicious-package qlvideo provisionql
安装rlwrap解决命令行下运行的命令无法使用键盘上下键问题
brew install rlwrap
安装tree用于树形方式显示目录
brew install tree
开发工具
安装wrk压力测试工具
brew install wrk
安装wireshark网络封包分析工具
brew cask install wireshark
# 或者
brew install wireshark --with-qt
brew cask install wireshark-chmodbpf
brew install sbcl
# 可以在命令行包裹rlwrap使用,在.zshrc中添加
tee -a ~/.zshrc << EOF
# 包裹Steel Bank Common Lisp以便支持键盘上下键
alias sbcl="rlwrap sbcl"
EOF
安装Java开发环境 参考
brew cask install java
# 或者安装JDK8,安装之前确保已经安装了caskroom/versions,如果没有可以通过brew tap caskroom/versions进行安装
brew cask install java8
如果觉得下载太慢可以在外部下载后拷贝的Cask缓存文件夹,通过
brew cask info java8
查看Java版本信息,进行手动下载
java8: 1.8.0_152-b16,aa0333dd3019491ca4f6ddbe78cdb6d0
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Not installed
From: https://github.com/caskroom/homebrew-versions/blob/master/Casks/java8.rb
==> Name
Java Standard Edition Development Kit
==> Artifacts
JDK 8 Update 152.pkg (Pkg)
==> Caveats
通过以下命令将下载好的dmg安装包拷贝到Cask缓存文件夹
cp ~/Downloads/jdk-8u152-macosx-x64.dmg `brew --cache`/Cask/`brew cask info java8 |grep java8: | sed -E "s/: /--/"`.dmg
brew cask install java8
brew install maven
安装Node.js开发环境,使用nvm进行管理 参考 安装Oh My ZSH! zsh-nvm插件
# 下载插件
git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm
# 添加插件到zsh配置中
perl -0777 -pe 's/^(plugins=\(\n(\s|.)*?)\)$/\1 zsh-nvm\n)\n#延迟加载zsh-nvm插件\nexport NVM_LAZY_LOAD=true\n/m' -i ~/.zshrc
# 更新nvm插件
nvm upgrade
# 安装Node.js https://github.com/creationix/nvm#usage
nvm install 8.9
# 设置默认Node.js版本
nvm alias default 8.9
# 使用特定版本
nvm use 6.12
brew install yarn --without-node
yarn config set registry https://registry.npm.taobao.org # 注册模块镜像
yarn config set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node源码镜像
yarn config set chromedriver_cdnurl http://npm.taobao.org/mirrors/chromedriver # chromedriver 镜像
yarn config set phantomjs_cdnurl http://npm.taobao.org/mirrors/phantomjs # phantomjs 镜像
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 镜像
yarn config set selenium_cdnurl http://npm.taobao.org/mirrors/selenium # Selenium 镜像
yarn config set sass_binary_site http://npm.taobao.org/mirrors/node-sass # node-sass 镜像
安装nginx使用homebrew nginx扩展仓库
# 添加扩展仓库
brew tap homebrew/nginx
# 查看安装配置选项
brew options nginx-full
brew info nginx-full
# 安装
brew install nginx-full --with-flv --with-gunzip --with-gzip-static --with-http2 --with-mp4 --with-realip --with-status --with-sub --with-cache-purge-module --with-echo-module --with-lua-module --with-mp4-h264-module --with-subs-filter-module
安装MySQL
brew install mysql
安装Alfred QRCode Python依赖
sudo easy_install pip
# 使用--user可以避免sudo
pip install --user pillow
pip install --user qrcode
安装golang开发环境
brew instal go
# 在.zshrc中添加
tee -a ~/.zshrc << EOF
# 添加golang path
export PATH=$PATH:/usr/local/opt/go/libexec/bin
EOF
# 安装Debug环境delve https://github.com/derekparker/delve
# 参考 https://github.com/go-delve/homebrew-delve/issues/19#issuecomment-330442033
brew install go-delve/delve/delve
cd $HOME/Library/Caches/Homebrew
tar xf delve-*.gz
# go into directory ( mine is delve-1.0.0-rc.2 )
sh scripts/gencert.sh # 需要输入密码
brew install go-delve/delve/delve