Hanjie's Blog

一只有理想的羊驼

显示资源库~/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
chflags hidden filename

显示文件

1
chflags nohidden filename

文件链接

1
ln -s /path/to/desired-folder ~/Dropbox/desired-folder

安装编译

Let's call this directory 'source_dir' (where this INSTALL file is). Before starting, create another directory which we will call 'build_dir'.

Do:

1
2
3
cd build_dir
cmake source_dir
make install

The "make install" step may require administrator privileges.

You can adjust the installation destination (the "prefix") by passing the -DCMAKE_INSTALL_PREFIX=myprefix option to cmake, as is explained in the message that cmake prints at the end.

删除

If you have a manifest file which lists all the files that were installed with make install you can run this command which I have from another answer:

1
cat install_manifest.txt | xargs echo rm | sh

If you have sudo make install you will need to add a sudo to your uninstall:

1
cat install_manifest.txt | xargs echo sudo rm | sh
0%