从终端窗口运行 Xcode 工具
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1930092/
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
Run Xcode tools from the Terminal window
提问by durcicko
This is something really simple, but I can't seem to find the answer anywhere, and I'm new to both Mac and UNIX, which doesn't help.
这真的很简单,但我似乎无法在任何地方找到答案,而且我对 Mac 和 UNIX 都不熟悉,这无济于事。
I've installed Xcode on my mac, along with the iPhone SDK 3.2. I'm trying to run Xcode command utilities that came with the SDK from the unix terminal, but I don't know how to update the paths so that the system knows where to find them. Here is what I do.
我已经在我的 Mac 上安装了 Xcode,以及 iPhone SDK 3.2。我正在尝试从 unix 终端运行 SDK 附带的 Xcode 命令实用程序,但我不知道如何更新路径以便系统知道在哪里可以找到它们。这就是我所做的。
- I launch the Terminal application
- I want to run 'xcrun', so I just type 'xcrun'
- I get an error saying '-bash: xcrun: command not found'
- I have xcrun installed under /Developer/usr/bin
- 我启动终端应用程序
- 我想运行“xcrun”,所以我只输入“xcrun”
- 我收到一条错误消息“-bash: xcrun: command not found”
- 我在 /Developer/usr/bin 下安装了 xcrun
Is there some sort of PATHS environment variable that I need to permanently update? Or perhaps Xcode comes with its own Terminal application with those new paths already baked in? Finally, what's the difference between sh and bash?
是否有某种 PATHS 环境变量需要永久更新?或者,也许 Xcode 带有自己的终端应用程序,其中已经包含了这些新路径?最后,sh 和 bash 有什么区别?
Thanks for the help!
谢谢您的帮助!
采纳答案by mipadi
I'm using Snow Leopard + Xcode, and xcodebuild
and xcrun
are both present at /usr/bin
. Regardless, they shouldbe present at /Developer/usr/bin
-- you just have to make sure that path is in your $PATH
variable. You can set it in your shell configuration file (~/.bashrc
for bash
) like so:
我使用的是雪豹+ Xcode中,并xcodebuild
与xcrun
同时存在的/usr/bin
。无论如何,它们应该出现在/Developer/usr/bin
——你只需要确保路径在你的$PATH
变量中。您可以在 shell 配置文件 ( ~/.bashrc
for bash
) 中设置它,如下所示:
export PATH="/Developer/usr/bin:${PATH}"
As for the difference between sh
and bash
, bash
supports some extensions and other features not found in the more primitive sh
; however, on Mac OS X, sh
and bash
are the same program (this is typical on many Unix and Linux systems nowadays). However, when bash
is invoked as sh
(that is, you call /bin/sh
from the command line, rather than /bin/bash
), bash
will try to act like the more "traditional" sh
program.
至于sh
和和的区别bash
,bash
支持一些扩展和其他更原始的没有的特性sh
;然而,在Mac OS X,sh
以及bash
同属于一个程序(这是许多Unix和Linux系统的典型时下)。但是, whenbash
被调用为sh
(即,您/bin/sh
从命令行调用,而不是/bin/bash
),bash
将尝试像更“传统”的sh
程序一样工作。