重装了Mac系统

安装系统

常用软件

HomeBrew

地址

touch ~/.bashrc
echo "export HOMEBREW_GITHUB_API_TOKEN=6b3d4908a0db7bbcab2699b24452bb71ef68d127" >> ~/.bashrc
brew tap caskroom/versions

更换镜像源

cd /usr/local
# 二者选其一即可更新
# 清华镜像源
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
# 中科大镜像源
git remote set-url origin http://mirrors.ustc.edu.cn/homebrew.git

# 后续操作
cd ~
mkdir tmp
cd tmp
# 以下要与你选择的镜像源相同
git clone git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
git clone http://mirrors.ustc.edu.cn/homebrew.git

sudo rm -rf /usr/local/.git
sudo rm -rf /usr/local/Library
sudo cp -R homebrew/.git /usr/local/
sudo cp -R homebrew/Library /usr/local/

# 排错
# 确保目录归属管理组
sudo chgrp -R admin /usr/local
# 确保管理组可读
sudo chmod -R g+w /usr/local

cask 及常用软件

brew install caskroom/cask/brew-cask 
brew cask install qq 
brew cask install qqmacmgr
brew cask install sourcetree 
brew cask install macdown 
brew cask install xiami 
brew cask install the-unarchiver
brew cask install key-codes

sublime

brew cask install sublime-text3
ln -s "/opt/homebrew-cask/Caskroom/sublime-text3/Build 3083/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl

python

brew install pyenv
pyenv install 3.5.0
# env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.5.0
# zipimport.ZipImportError: can't decompress data; zlib not available
# xcode-select --install
pyenv global 3.5.0
pyenv rehash
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
# ~/.pyenv/cache 默认缓存目录,下载速度慢时可手动下载到这里再pyenv install

更换pip源

# http://pypi.douban.com/  豆瓣
# http://pypi.hustunique.com/  华中理工大学
# http://pypi.sdutlinux.org/  山东理工大学
# http://pypi.mirrors.ustc.edu.cn/  中国科学技术大学
# pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com numpy

ruby

brew install rbenv
rbenv install 2.2.3
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
rbenv global 2.2.3
rbenv rehash

更换gem源为淘宝源

gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/

php

brew install automake autoconf curl pcre re2c mhash libtool icu4c gettext jpeg libxml2 mcrypt gmp libevent
brew link icu4c
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/bin/phpbrew
phpbrew init
echo "source $HOME/.phpbrew/bashrc" >> ~/.bashrc
phpbrew known
phpbrew install 5.6.15

jekyll

gem install jekyll
gem install jekyll-paginate
gem install redcarpet

ohmyz

地址

# 安装zsh
brew cask install zsh
# 安装oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# 自动补全失效时:
compaudit | xargs chmod g-w
compaudit | xargs chown root
rm -f ~/.zcompdump; compinit
# 安装powerline(增强命令行的显示)
pip install powerline-status
pip show powerline-status
# 下面这个目录要根据powerline-status的结果来调整
echo ". /Users/vkyii/.pyenv/versions/3.5.0/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh" >> ~/.bashrc
# 安装powerline的字体
git clone https://github.com/powerline/fonts.git
cd fonts
./install.sh
curl -fsSL https://github.com/abertsch/Menlo-for-Powerline/archive/master.zip

iterm2

brew cask install iterm2
# 下载配色
curl -fsSL https://github.com/mbadolato/iTerm2-Color-Schemes/archive/master.zip
# 自动登录SSH
brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/sshpass.rb
/usr/local/Cellar/sshpass/1.05/bin/sshpass -p password ssh -o StrictHostKeychecking=no root@115.28.147.152

进一步的配置

Vim

brew install vim --with-lua
# Macvim依赖于XCode,先从AppStore安装,再同意其license
brew install macvim --with-override-system-vim --with-lua
brew linkapp macvim

Tmux

brew install tmux
# 处理类似subl命令行打不开的问题
brew install reattach-to-user-namespace
echo 'alias subl="reattach-to-user-namespace subl"' >> ~/.bashrc

proxychains + shadowsocks

brew cask install shadowsocksx
brew install proxychains-ng

推荐配置(/usr/local/Cellar/proxychains-ng/4.10/etc/proxychains.conf)

strict_chain
proxy_dns 
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
localnet 127.0.0.0/255.0.0.0
quiet_mode

[ProxyList]
socks5  127.0.0.1 1080

使用:

proxychains4 curl https://www.twitter.com/
proxychains4 git push origin master

alfred

非brew

字体(中英文等宽)

参考