I'm relatively new to mac and now trying to setup a dev. environment for Cordova based iOS app. I'm using Yosemite 10.10.3
我是相对较新的mac,现在正试图设置开发。基于Cordova的iOS应用程序的环境。我正在使用Yosemite 10.10.3
I've installed xcode 6.3.1 and the commandlinetools for 6.3.1, under /Applications/Xcode.app/Contents/Developer/ I can see usr/bin and usr/lib, also xcode-select -p is pointing to this path, so I think the command line tool is fine.
我已经安装了xcode 6.3.1和6.3.1的命令行工具,在/Applications/Xcode.app/Contents/Developer/下我可以看到usr / bin和usr / lib,xcode-select -p也指向这条路径,所以我认为命令行工具很好。
However, when I run xcodebuild I got command not found. I've manually added the path above into the PATH environment variable to make xcodebuild visible, but not sure why this is needed, I thought the installation should have taken care of this.
但是,当我运行xcodebuild时,我找不到命令。我已经手动将上面的路径添加到PATH环境变量中以使xcodebuild可见,但不确定为什么需要这样,我认为安装应该已经处理好了。
Then when xcrun was executed in certain script ( npm install -g ios-deploy ), I got the following error:
然后当在某些脚本(npm install -g ios-deploy)中执行xcrun时,我收到以下错误:
dyld: Library not loaded: @rpath/libxcrun.dylib referenced from /usr/bin/xcrun, reason: image not found.
dyld:库没有加载:@rpath / libxcrun.dylib是从/ usr / bin / xcrun引用的,原因:找不到图像。
I see xcrun is available in /usr/bin as well as in the usr/bin under command line tool installation path. But the libxcrun.dylib is only available in the installation path.
我看到xcrun在/ usr / bin以及命令行工具安装路径下的usr / bin中可用。但是libxcrun.dylib仅在安装路径中可用。
I manually copied this dynamic library to /usr/lib and xcrun worked.
我手动将这个动态库复制到/ usr / lib并且xcrun工作了。
Though it seemed working but I got suspicious, such manual actions shouldn't be the normal post-installation procedure, should they?
虽然它似乎有效,但我怀疑,这样的手动操作不应该是正常的安装后程序,如果它们?
Is there something I forgot to do after the command line installation? What if there's more such little files I need to copy/move around? Can I simply specify the installation path somewhere?
命令行安装后有什么我忘了做的吗?如果有更多这样的小文件我需要复制/移动怎么办?我可以简单地在某处指定安装路径吗?
BTW, I added the install path/usr/lib into PATH, but didn't work with xcrun, had to copy the .dylib.
顺便说一下,我将安装路径/ usr / lib添加到PATH中,但是没有使用xcrun,不得不复制.dylib。
There's other mac which the Xcode and CLT were upgraded from previous version, and there no such issue.
Xcode和CLT从之前的版本升级了其他mac,没有这样的问题。
1 个解决方案
#1
Well, after some try-out I've got ios-deploy installed by npm. I'm not sure if what I did is preferred resolution, to me it's more like a workaround.
好吧,经过一些尝试,我已经安装了npm的ios-deploy。我不确定我所做的是首选分辨率,对我而言,它更像是一种解决方法。
First of all, as far as I see, if it was upgraded from previous version of CLT or Xcode, such issue doesn't exist, though all the executable behaviour are the same.
首先,据我所知,如果它是从以前版本的CLT或Xcode升级的,那么这个问题不存在,尽管所有可执行行为都是相同的。
e.g. /usr/bin/xcrun will be used, and /usr/lib doesn't have libxcrun.dylib, while @executable_path=../lib, meaning xcrun is looking for library in the ../lib location.
例如将使用/ usr / bin / xcrun,而/ usr / lib没有libxcrun.dylib,而@executable_path = .. / lib,这意味着xcrun正在../lib位置查找库。
Normally the library not loaded error is expected, but somehow with the upgraded case some hidden setting told xcrun to search for library in the correct path.
通常情况下,库未加载错误是预期的,但不知何故,在升级的情况下,一些隐藏的设置告诉xcrun在正确的路径中搜索库。
I've tried DYLD_LIBRARY_PATH, worked with gcc and xcrun but didn't work with npm install. I can only fix the error by copying the lib file to /usr/lib at the moment.
我已经尝试过DYLD_LIBRARY_PATH,使用gcc和xcrun但是没有使用npm install。我只能通过将lib文件复制到/ usr / lib来修复错误。
Well, I'm still getting "cannot infer developer directory from our own path (/usr/bin/xcrun)" warning, even though I've set DEVELOPER_DIR to the correct one, and xcode-select -p shows the same.
好吧,我仍然得到“无法从我们自己的路径(/ usr / bin / xcrun)推断开发人员目录”警告,即使我已将DEVELOPER_DIR设置为正确的,并且xcode-select -p显示相同。
But this warning seems not doing harm to npm install -g ios-deploy ...... therefore I can live with it for now.
但是这个警告似乎没有对npm install -g ios-deploy造成伤害......所以我现在可以忍受它了。
So the mystery persisted. I still don't know why /usr/bin/xcrun has to be used instead of CLT/usr/bin/xcrun, I still don't know how in the upgraded case /usr/bin/xcrun managed to locate the correct lib file and didn't throw any warning. What's the difference between the new installation and upgrade?
所以这个谜仍然存在。我仍然不知道为什么必须使用/ usr / bin / xcrun代替CLT / usr / bin / xcrun,我仍然不知道如何在升级的情况下/ usr / bin / xcrun设法找到正确的lib文件并没有抛出任何警告。新安装和升级之间有什么区别?
This answer is just providing a workaround to continue without recreating everything on the machine.
这个答案只是提供了一种解决方法,可以在不重新创建机器上的所有内容的情
Additional information:
As shown in comments, afterwards I found ios-sim is not working, always crash with exception, thus I had to reinstall OS and started over. The issue disappeared. Now the only difference I can remember, is I installed mac ports in between of OS and xcode during last time. My recommendation would be, install Xcode right after the OS to avoid unexpected system changes.
如评论中所示,之后我发现ios-sim无法运行,总是崩溃异常,因此我不得不重新安装操作系统并重新启动。这个问题消失了。现在我能记住的唯一区别是,我上次在OS和xcode之间安装了mac端口。我的建议是,在操作系统之后立即安装Xcode,以避免意外的系统更改。
#1
Well, after some try-out I've got ios-deploy installed by npm. I'm not sure if what I did is preferred resolution, to me it's more like a workaround.
好吧,经过一些尝试,我已经安装了npm的ios-deploy。我不确定我所做的是首选分辨率,对我而言,它更像是一种解决方法。
First of all, as far as I see, if it was upgraded from previous version of CLT or Xcode, such issue doesn't exist, though all the executable behaviour are the same.
首先,据我所知,如果它是从以前版本的CLT或Xcode升级的,那么这个问题不存在,尽管所有可执行行为都是相同的。
e.g. /usr/bin/xcrun will be used, and /usr/lib doesn't have libxcrun.dylib, while @executable_path=../lib, meaning xcrun is looking for library in the ../lib location.
例如将使用/ usr / bin / xcrun,而/ usr / lib没有libxcrun.dylib,而@executable_path = .. / lib,这意味着xcrun正在../lib位置查找库。
Normally the library not loaded error is expected, but somehow with the upgraded case some hidden setting told xcrun to search for library in the correct path.
通常情况下,库未加载错误是预期的,但不知何故,在升级的情况下,一些隐藏的设置告诉xcrun在正确的路径中搜索库。
I've tried DYLD_LIBRARY_PATH, worked with gcc and xcrun but didn't work with npm install. I can only fix the error by copying the lib file to /usr/lib at the moment.
我已经尝试过DYLD_LIBRARY_PATH,使用gcc和xcrun但是没有使用npm install。我只能通过将lib文件复制到/ usr / lib来修复错误。
Well, I'm still getting "cannot infer developer directory from our own path (/usr/bin/xcrun)" warning, even though I've set DEVELOPER_DIR to the correct one, and xcode-select -p shows the same.
好吧,我仍然得到“无法从我们自己的路径(/ usr / bin / xcrun)推断开发人员目录”警告,即使我已将DEVELOPER_DIR设置为正确的,并且xcode-select -p显示相同。
But this warning seems not doing harm to npm install -g ios-deploy ...... therefore I can live with it for now.
但是这个警告似乎没有对npm install -g ios-deploy造成伤害......所以我现在可以忍受它了。
So the mystery persisted. I still don't know why /usr/bin/xcrun has to be used instead of CLT/usr/bin/xcrun, I still don't know how in the upgraded case /usr/bin/xcrun managed to locate the correct lib file and didn't throw any warning. What's the difference between the new installation and upgrade?
所以这个谜仍然存在。我仍然不知道为什么必须使用/ usr / bin / xcrun代替CLT / usr / bin / xcrun,我仍然不知道如何在升级的情况下/ usr / bin / xcrun设法找到正确的lib文件并没有抛出任何警告。新安装和升级之间有什么区别?
This answer is just providing a workaround to continue without recreating everything on the machine.
这个答案只是提供了一种解决方法,可以在不重新创建机器上的所有内容的情
Additional information:
As shown in comments, afterwards I found ios-sim is not working, always crash with exception, thus I had to reinstall OS and started over. The issue disappeared. Now the only difference I can remember, is I installed mac ports in between of OS and xcode during last time. My recommendation would be, install Xcode right after the OS to avoid unexpected system changes.
如评论中所示,之后我发现ios-sim无法运行,总是崩溃异常,因此我不得不重新安装操作系统并重新启动。这个问题消失了。现在我能记住的唯一区别是,我上次在OS和xcode之间安装了mac端口。我的建议是,在操作系统之后立即安装Xcode,以避免意外的系统更改。