Mac新系统配置

显示资源库~/Library文件夹

打开Finder,先按shift-command-H,再按command-J,在弹窗口中选取“显示资源库文件夹”1

Bash profile 设置

Mac OS的 默认PATH为/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin2。我们想让Homebrew安装的软件优先级大于系统默认安装的软件(如Python)。在Terminal打开:

1
vim ~/.bash_profile

并且添加:

1
2
3
4
5
6
# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc

第一句的作用是让编译器知道系统是64位的。然后执行下面一句让配置生效:

1
source ~/.bash_profile

安装proxychains-ng

在使用brew update时,发现速度十分慢,于是可以尝试使用ProxyChains-NG3,官方说明:

proxychains ng (new generation) - a preloader which hooks calls to sockets in dynamically linked programs and redirects it through one or more socks/http proxies. continuation of the unmaintained proxychains project.

使用Homebrew安装(如果是10.11,要先关闭SIP),并配置:

1
2
brew install proxychains-n
vim /usr/local/etc/proxychains.conf

在末尾,删掉socks4的那一条目(重要),并且根据实际添加代理:

1
socks5  127.0.0.1 1080

然后就可以通过在命令面前添加proxychains4使用代理了,如:

1
2
proxychains4 brew update
proxychains4 brew upgrade

安装Python及库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
brew tap homebrew/science

brew install python

pip install virtualenv

pip install numpy

pip install cython
brew install gcc

pip install scipy
pip install matplotlib

brew install opencv3 --with-contrib --with-ffmpeg --with-tbb --with-libdc1394 --without-tests

echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth

  1. https://hackercodex.com/guide/mac-osx-mavericks-10.9-configuration/↩︎

  2. https://hackercodex.com/guide/mac-osx-mavericks-10.9-configuration/↩︎

  3. http://huifeng.me/2015/08/23/ProxyChains-NG-4-OSX-Setting/↩︎