因爲版本兼容問題,Mac下Graphviz以前一直裝的是低版本的2.36。高版本的安裝方法以下:php
一、log in & download Xcode an Xcode Command Line Tools from
https://developer.apple.com/downloads/
install Xcode and the Xcode Command Line Toolspython
二、agree to Xcode license in terminal:
sudo xcodebuild –licensemacos
三、get MacPorts pkg installer for your version of osx from
https://www.macports.org/install.php#installing
install MacPorts for your version of osxxcode
四、in terminal:
sudo port -v selfupdateapp
五、install graphviz via MacPorts. in terminal:
sudo port install graphviz-guiui
installed gui application can be found here: /Application/Macports/Graphviz.appthis
相關MacPorts的命令說明能夠看: http://blog.csdn.net/moliyll/article/details/7898600.net
我這裏因爲有以前的版本的 graphviz, 安裝時候提示:命令行
$ sudo port install graphviz-gui
---> Computing dependencies for graphviz-gui
---> Cleaning graphviz-gui
---> Scanning binaries for linking errors
Warning: Error parsing file /Applications/MacPorts/Graphviz.app/Contents/MacOS/Graphviz: Error opening or reading file
---> No broken files found.code
解決方法:
先用 AppCleaner 清除以前的安裝文件。
再用 sudo port uninstall graphviz-gui 卸載以前的安裝依賴。
而後從新安裝就能夠安裝成功了 2.40.1。
另外在作安裝時,提示我要設置一些默認python 。 執行下面任何一個命令均可以完成。
---> Some of the ports you installed have notes:
python27 has the following notes:
To make this the default Python or Python 2 (i.e., the version run by the
'python' or 'python2' commands), run one or both of:
sudo port select --set python python27
sudo port select --set python2 python27
##############################################################
# IF YOU ARE USING PYTHON FROM THE TERMINAL, PLEASE INSTALL:
# py27-readline
# TO AVOID A LIBEDIT / PYTHON INTERACTION ISSUE.
# REF: https://trac.macports.org/ticket/48807
##############################################################
這種方式安裝完成後, GUI和命令行都是升級到了 2.40.1 版本了。
$ dot -V
dot - graphviz version 2.40.1 (20161225.0304)
參考: