这次重装系统以后,打算尽可能不用虚拟机了,所有工具能移植的移植,不能移植的就找替代品,全部原生使用。brew可以安装大部分常用工具,个别brew更新不及时的工具就需要自己下载编译,比如mfoc
首先安装编译mfoc所需的环境工具:
brew install libtool brew install automake brew install autoconf brew install libusb brew install pkg-config brew install glib
然后下载libnfc,并编译安装:
git clone https://github.com/nfc-tools/libnfc cd libnfc autoreconf -vis ./configure --with-drivers=acr122_pcsc make install
如果一切顺利就可以下载安装mfoc了,方法类似:
git clone https://github.com/nfc-tools/mfoc cd mfoc autoreconf -vis ./configure make install
为了正常运行mfoc以及nfc-list,osx系统还需要做一些额外的配置,否则会出现nfc-list找不到设备之类的情况
首先要关闭sip,开机按command+R进入恢复模式,然后执行
csrutil disable
接下来保证pcscd服务正常运行,在主系统增加一个kext
/System/Library/Extensions/DUMMY.kext/Contents/Info.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!-- This is a dummy driver which binds to ACR122U. It --> <!-- contains no actual code; its only purpose is to --> <!-- prevent Apple's USBHID driver from exclusively --> <!-- opening the device. --> <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleIconFile</key> <string /> <key>CFBundleIdentifier</key> <string>com.ACR122U.dummy.kext</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundlePackageType</key> <string>KEXT</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> <string>1.0.0d1</string> <key>IOKitPersonalities</key> <dict> <!-- The ACR122U USB interface --> <key>ACR122U</key> <dict> <key>CFBundleIdentifier</key> <string>com.ACR122U.dummy.kext</string> <key>IOClass</key> <string>com.ACR122U.dummy.kext</string> <key>IOProviderClass</key> <string>IOUSBInterface</string> <key>bConfigurationValue</key> <integer>1</integer> <key>bInterfaceNumber</key> <integer>0</integer> <key>idProduct</key> <integer>XXXXXXXXXXXXXXXXXXXXX</integer> <key>idVendor</key> <integer>XXXXXXXXXXXXXXXXXXXXX</integer> </dict> </dict> <key>OSBundleLibraries</key> <dict> <key>com.apple.iokit.IOUSBFamily</key> <string>1.8</string> </dict> </dict> </plist>
其中idProduct和idVendor可以通过
system_profiler SPUSBDataType
获得,最后执行
sudo kextload -verbose /System/Library/Extensions/DUMMY.kext
加载kext