今天开始搭建 Robot Framework 环境。因为本人使用 Mac 最新的操作系统 OS X EI Capitan 10.11.3
在安装 wxPython 的时候遇到了双击 dmg 安装包包错的问题,使用一下方法可以顺利安装。过程原理就是重新打包一个 pkg 包,重新安装。
在 OS X 中打开终端,按照下面的 shell 命令输入就可以了。

# base workdir
mkdir ~/wxpython_elcapitan
cd ~/wxpython_elcapitan

# download the wxPython dmg
curl -L "http://downloads.sourceforge.net/project/wxpython/wxPython/3.0.2.0/wxPython3.0-osx-3.0.2.0-cocoa-py2.7.dmg?r=http%3A%2F%2Fwww.wxpython.org%2Fdownload.php&ts=1453708927&use_mirror=netix" -o wxPython3.0-osx-3.0.2.0-cocoa-py2.7.dmg

# mount the dmg
hdiutil attach wxPython3.0-osx-3.0.2.0-cocoa-py2.7.dmg

# copy the dmg package to the local disk
mkdir ~/wxpython_elcapitan/repack_wxpython
cd ~/wxpython_elcapitan/repack_wxpython
cp -r /Volumes/wxPython3.0-osx-3.0.2.0-cocoa-py2.7/wxPython3.0-osx-cocoa-py2.7.pkg .

# unmount the dmg
dmgdisk="$(hdiutil info | grep '/Volumes/wxPython3.0-osx-3.0.2.0-cocoa-py2.7' | awk '{ print $1; }')"
hdiutil detach ${dmgdisk}

# prepare the new package contents
mkdir ~/wxpython_elcapitan/repack_wxpython/pkg_root
cd ~/wxpython_elcapitan/repack_wxpython/pkg_root
pax -f ../wxPython3.0-osx-cocoa-py2.7.pkg/Contents/Resources/wxPython3.0-osx-cocoa-py2.7.pax.gz -z -r
cd ~/wxpython_elcapitan/repack_wxpython

# prepare the new package scripts
mkdir ~/wxpython_elcapitan/repack_wxpython/scripts
cp wxPython3.0-osx-cocoa-py2.7.pkg/Contents/Resources/preflight scripts/preinstall
cp wxPython3.0-osx-cocoa-py2.7.pkg/Contents/Resources/postflight scripts/postinstall

# delete the old package
rm -rf ~/wxpython_elcapitan/repack_wxpython/wxPython3.0-osx-cocoa-py2.7.pkg

# build the new one :
pkgbuild --root ./pkg_root --scripts ./scripts --identifier com.wxwidgets.wxpython wxPython3.0-osx-cocoa-py2.7.pkg

# put the package on Desktop, and clean workdir
mv ~/wxpython_elcapitan/repack_wxpython/wxPython3.0-osx-cocoa-py2.7.pkg ~/Desktop/
cd ~
rm -rf ~/wxpython_elcapitan

# install it ! it will ask for your password (to become superuser/root)
sudo installer -pkg ~/Desktop/wxPython3.0-osx-cocoa-py2.7.pkg -target /

# EOF


↙↙↙阅读原文可查看相关链接,并与作者交流