[英]Error: Can't run /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/ibtool (no such file)
I'm trying to use ibtool for iOS development (localization), but when I run it from terminal I get the following error: 我正在尝试使用ibtool进行iOS开发(本地化),但是当我从终端运行它时出现以下错误:
Error: Can't run /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/ibtool (no such file).
What gives? 是什么赋予了?
Did some digging on this one and found a few good Stack responses to similar problems - but no generic solutions for all comers, so I figured I'd make one. 有人在挖掘这个并找到了一些好的Stack对类似问题的反应 - 但没有针对所有人的通用解决方案,所以我想我会做一个。 :) :)
The cause of the problem is: in modern versions of OSX, if you install Xcode from the App Store, it installs itself like all other Apps - which means it's in a different directory than was historically the case. 这个问题的原因是:在OSX的现代版本,如果你从App Store安装的Xcode,它会自行安装像所有其他的应用程序-这意味着它在不同的目录是历史的情况。 Unfortunately, this has far-reaching implications that affect both Xcode and its command-line tools and - in fact - other things that reach far beyond the scope of this question. 不幸的是,这具有深远的影响,影响Xcode及其命令行工具,事实上 - 其他事情远远超出了这个问题的范围。
So, until they fix it, let's talk workarounds . 所以,在他们解决之前, 让我们谈谈解决方法 。 Many people recommend changing your Xcode system variables to point to the 'App Store' folder, but I think this is a dangerous overkill - you just don't know what kind of mayhem it may cause if they ever fix their pathing! 许多人建议更改你的Xcode系统变量以指向'App Store'文件夹,但我认为这是一个危险的过度杀伤 - 你只是不知道如果他们修复他们的路径可能会造成什么样的混乱!
Instead, I recommend using Terminal to change only the system link affecting ibtool
(or whatever tool you're using), like so: 相反,我建议使用终端仅更改影响ibtool
(或您正在使用的任何工具)的系统链接,如下所示:
Recommended solution 推荐解决方案
Step 1: Remove the old system link 第1步:删除旧的系统链接
sudo rm /usr/bin/ibtool
Step 2: Create a new system link 第2步:创建新的系统链接
sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool /usr/bin/ibtool
For reference only, here is another command that will fix this - but I DO NOT recommend using it for the reasons stated above: 仅供参考,这是另一个将解决此问题的命令 - 但由于上述原因,我不建议使用它:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
I can see the argument that xcode-select
might be a proper solution if you have all kinds of /Developer-related errors, but in that case I would just reinstall Xcode without using the App Store and get it going good from the start. 我可以看到xcode-select
可能是一个合适的解决方案,如果你有各种/ Developer相关的错误,但在这种情况下,我只是重新安装Xcode而不使用App Store并从一开始就让它变好。
For the rest of us already too far down the App Store path to re-do it all, see above. 对于我们其他人已经在App Store路径上走得太远以重新完成所有操作,请参见上文。
Absolute first step is to get Xcode to install the command line tools
. 绝对的第一步是让Xcode安装command line tools
。 Doing that will get the tools into /usr/bin
- which is already in your PATH. 这样做会将工具放入/usr/bin
- 这已经在你的PATH中了。 Go to " Xcode" :: "Preferences" :: "Downloads" :: "Components" where there should be an install Command Line Tools
. 转到“ Xcode”::“Preferences”::“Downloads”::“Components” ,其中应该有一个安装Command Line Tools
。 If there isn't, go to "Xcode" :: "Open Developer Tool" :: "More Developer Tools" and download the most recent command line tools. 如果没有,请转到“Xcode”::“Open Developer Tool”::“More Developer Tools”并下载最新的命令行工具。
As you are using Xcode 7, the libtool is located in the following path: 当您使用Xcode 7时,libtool位于以下路径中:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
What you can do here is simply copy it, and then paste it to the error's specified location: 你可以在这里做的只是复制它,然后将其粘贴到错误的指定位置:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/libtool
You should also paste the file in the following path if you are planing to run the app on a device: 如果您计划在设备上运行应用程序,则还应将文件粘贴到以下路径中:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool
if you didn't find the usr/bin just create a folder and call it usr, and another one inside it and call it bin. 如果你没有找到usr / bin,只需创建一个文件夹并将其称为usr,并在其中另一个文件夹并将其称为bin。 the paste the libtool inside it. 将libtool粘贴到其中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.