错误:无法运行/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/ibtool(没有这样的文件)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11423215/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:50:50  来源:igfitidea点击:

Error: Can't run /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/ibtool (no such file)

xcodemacosxcode4osx-lionxcode4.3

提问by toblerpwn

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?

是什么赋予了?

回答by toblerpwn

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. :)

对此进行了一些挖掘,并发现了一些对类似问题的良好堆栈响应 - 但没有适用于所有来者的通用解决方案,所以我想我会做一个。:)

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 directorythan was historically the case. 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.

问题的原因是:在现代版本的 OSX 中,如果您从 App Store 安装 Xcode,它会像所有其他应用程序一样自行安装 - 这意味着它位于历史情况不同的目录中。不幸的是,这具有深远的影响,会影响 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 onlythe system link affecting ibtool(or whatever tool you're using), like so:

相反,我建议使用终端更改影响系统链接ibtool(或您使用的任何工具),如下所示:

Recommended solution

推荐方案

Step 1: Remove the old system link

第一步:删除旧的系统链接

sudo rm /usr/bin/ibtool

Step 2: Create a new system link

第二步:新建系统链接

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 recommendusing it for the reasons stated above:

仅供参考,这是另一个可以解决此问题的命令 - 但由于上述原因,我不建议使用它:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

I can see the argument that xcode-selectmight 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 的道路上已经走得太远了,无法重新做这一切,请参见上文。

回答by girgen

Absolute first step is to get Xcodeto install the command line tools. Doing that will get the tools into /usr/bin- which is already in your PATH. Go to "Xcode" :: "Preferences" :: "Downloads" :: "Components"where there should be an install 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安装command line tools. 这样做将使工具进入/usr/bin- 这已经在您的 PATH 中。转到“ Xcode”::“Preferences”::“Downloads”::“Components”,那里应该有安装Command Line Tools。如果没有,请转到“Xcode”::“Open Developer Tool”::“More Developer Tools”并下载最新的命令行工具。

回答by Ahmad Al-Attal

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. the paste the libtool inside it.

如果您没有找到 usr/bin,只需创建一个文件夹并将其命名为 usr,然后在其中创建另一个文件夹并将其命名为 bin。将 libtool 粘贴在其中。