我想让这个gem在os x小牛上运行:https://github.com/drbrain/pasteboard/blob/master/ext/pasteboard/extconf.rb
目前,安装此宝石通过cc失败,因为不存在。
它现在位于gem install pasteboard
和/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework
当然,用另一个硬编码字符串替换一个硬编码字符串是不干净的。我知道我可以通过运行/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/Current/Frameworks/HIServices.framework
到达路径的第一部分(/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/Current/Frameworks/HIServices.framework
)但剩下的路呢我只是测试我是在10.8还是10.9上,然后附加正确的路径,还是有更干净的方法?
谢谢您!
最佳答案
好吧,我想我已经想好了:
xcrun --show-sdk-path
这给了我:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
所以我可以这样做:
sdk_path = `xcrun --show-sdk-path`.strip
puts File.join(sdk_path, 'System/Library/Frameworks/ApplicationServices.framework/Versions/Current/Frameworks/HIServices.framework')
这应该是个好办法!
关于ruby - 如何在ruby extconf.rb文件中指向OS X框架?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21608625/