使用“make”;在 OS X 上
我有一台 MacBook Pro,我正在尝试对其进行一些开发。
我有一个想要构建的程序,当我使用 make
构建它时,出现“找不到命令”错误。我做了一些谷歌搜索和 StackOverflow 搜索,看起来这不是一个常见问题。为什么我没有安装 make
以及如何获取它?
我特别困惑,因为我知道我最近(在过去一个月左右)在这台笔记本电脑上使用过它。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
此外,如果您已将用户文件和应用程序从一台 Mac 迁移到另一台 Mac,则需要重新安装 Apple 开发人员工具。迁移助手不考虑开发人员工具的安装。
In addition, if you have migrated your user files and applications from one mac to another, you need to install Apple Developer Tools all over again. The migration assistant does not account for the developer tools installation.
如果您已安装 Xcode 4.3 及其命令行工具,只需打开终端并键入以下内容:在 Xcode 4.3 上,在终端中键入以下内容:
export PATH=$PATH:/Applications/Xcode.app/Contents/Developer /usr/bin
If you've installed Xcode 4.3 and its Command Line Tools, just open Terminal and type the following: On Xcode 4.3, type the following in Terminal:
export PATH=$PATH:/Applications/Xcode.app/Contents/Developer/usr/bin
@Daniel 的建议对我来说非常有效。安装
, open Xcode, go to Preferences -> Downloads -> Components -> Command Line Tools.You can then test with
@Daniel's suggestion worked perfectly for me. To install
, open Xcode, go to Preferences -> Downloads -> Components -> Command Line Tools.You can then test with
我同意其他两个答案:安装Apple开发者工具。
但还值得注意的是,OS X 附带了 ant 和 rake。
I agree with the other two answers: install the Apple Developer Tools.
But it is also worth noting that OS X ships with ant and rake.
我相信您还可以获得大约 170 MB 的 Xcode 命令行工具。它在“brew”设置指南中进行了描述:https://github.com/mxcl/homebrew/wiki/installation 可以在这里找到:https://developer.apple.com/downloads/index.action#
编辑:@josh 上面已经提到过这一点
I believe you can also get just the Xcode command-line tools which is about 170 MB.. It's described in the 'brew' setup guide: https://github.com/mxcl/homebrew/wiki/installation and can be found here: https://developer.apple.com/downloads/index.action#
Edit: this was already mentioned above by @josh
我发现开发人员工具并不像其他工具那样容易获得。在 El Capitan 中,在终端中我只使用了 gcc -v,然后它说 gcc 不可用,并询问我是否要安装命令行 Apple Developer Tools。无需下载 Xcode。终端会话如下:
I found the Developer Tools not as readily available as others. In El Capitan, in terminal I just used gcc -v, it then said gcc wasn't available and asked if I wanted to install the command line Apple Developer Tools. No downloading of Xcode required. Terminal session below:
对于那些使用 Xcode 4.3 和 Lion 访问此页面的人来说,默认情况下不再捆绑命令行工具,并且不再有 /Developer。要安装它们,请打开 Xcode,转到“首选项”->“下载->组件->命令行工具。这应该安装 make、gcc 等。
For those of you who get to this page using Xcode 4.3 and Lion, the command line tools are no longer bundled by default, and there is no /Developer anymore. To install them, open Xcode, go to Preferences -> Downloads -> Components -> Command Line Tools. This should install make, gcc etc.
你安装了苹果开发者工具吗?
如果输入 gcc -v 会发生什么?
看来您还没有下载开发内容。您可以从 http://developer.apple.com/ 免费获取它(注册后)
Have you installed the Apple developer tools?
What happens if you type gcc -v ?
It look as if you do not have downloaded the development stuff. You can get it for free (after registration) from http://developer.apple.com/
现在有另一种方法可以通过 在 OS X 上安装 gcc 工具链osx-gcc-installer 这包括:
下载量为 282MB,而 Xcode 为 3GB。
There is now another way to install the gcc toolchain on OS X through the osx-gcc-installer this includes:
The download is 282MB vs 3GB for Xcode.
您必须安装 OS X 安装磁盘中作为可选包提供的“开发人员工具”。
You will have to install the "Developer Tools" that are provided as optional packages in OS X installation disks.
对于 Xcode 4.1,您只需将 /Developer/usr/bin 添加到 PATH 环境变量即可。这很容易做到:
还要确保更新您的 ~/.bashrc (或 ~/.profile 或 ~/.bash_login)文件。
For Xcode 4.1 you can simply add /Developer/usr/bin to the PATH environment variable. This is easily done:
Also be certain to update your ~/.bashrc (or ~/.profile or ~/.bash_login) file.