安裝 Cmake Source distribution

  1. 下載cmake-3.9.0-rc5.tar.gz
  2. 解壓cmake-3.9.0-rc5.tar.gz,會生成cmake-3.9.0-rc5/的資料夾
    $ tar xvf cmake-3.9.0-rc5.tar.gz
  3. 進入cmake-3.9.0-rc5/
    $ cd cmake-3.9.0-rc5/
  4. 這裡含有CMakeLists.txt 和configure,我們默認使用configure(假設我們暫時沒有cmake)
    $ ./configure --prefix=`pwd`/_install/ (--prefix可以隨意指定,只是我們在加入PATH時,加入我們指定目錄的bin就可以了)
  5. 編譯,安裝:
    $ make && make install (如果前面指定的目錄不在你的用戶目錄下,也許在安裝時沒有權限,我們需要在make install 前面加上sudo)
  6. 設定環境變數:
    打開.bash_profile
    $ open ~/.bash_profile
    加入 export PATH=/Applications/CMake.app/Contents/bin:$PATH

安裝 ROOT

下載root_v5.34.36.source.tar.gz
$ mkdir -p ~/local/root_v5.34.36/build
$ cd ~/local/root_v5.34.36
$ tar zxvf ~/Downloads/root_v5.34.36.source.tar.gz
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=~/local/root_v5.34.36/install ~/local/root_v5.34.36/root
$ time make -j4 | tee my_makelog
$ make install
$ echo '#' >> ~/.bash_profile
$ echo '# ROOT initilization' >> ~/.bash_profile
$ echo 'source ~/local/root_v5.34.36/install/bin/thisroot.sh' >> ~/.bash_profile

設定 PyROOT

打開.bash_profile
$ open ~/.bash_profile
加入 export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH