使用“make”;在 OS X 上

发布于 2024-08-06 12:10:25 字数 222 浏览 2 评论 0 原文

我有一台 MacBook Pro,我正在尝试对其进行一些开发。

我有一个想要构建的程序,当我使用 make 构建它时,出现“找不到命令”错误。我做了一些谷歌搜索和 StackOverflow 搜索,看起来这不是一个常见问题。为什么我没有安装 make 以及如何获取它?

我特别困惑,因为我知道我最近(在过去一个月左右)在这台笔记本电脑上使用过它。

I have a MacBook Pro that I'm trying to do some development on.

I have a program I want to build, and when I went to use make to build it, I got a "command not found" error. I did some googling and Stack Overflow searches and it doesn't look like this is a common problem. Why don't I have make installed and how do I get it?

I'm extra confused, because I know I used it relatively recently (in the past month or so) when I was on this laptop.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

迷离° 2024-08-13 12:10:26

此外,如果您已将用户文件和应用程序从一台 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.

剩一世无双 2024-08-13 12:10:26

如果您已安装 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

我一直都在从未离去 2024-08-13 12:10:26

@Daniel 的建议对我来说非常有效。安装

make

, open Xcode, go to Preferences -> Downloads -> Components -> Command Line Tools.You can then test with

gcc -v

@Daniel's suggestion worked perfectly for me. To install

make

, open Xcode, go to Preferences -> Downloads -> Components -> Command Line Tools.You can then test with

gcc -v

酒几许 2024-08-13 12:10:26

我同意其他两个答案:安装Apple开发者工具。

但还值得注意的是,OS X 附带了 antrake

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.

与风相奔跑 2024-08-13 12:10:26

我相信您还可以获得大约 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

看春风乍起 2024-08-13 12:10:26

我发现开发人员工具并不像其他工具那样容易获得。在 El Capitan 中,在终端中我只使用了 gcc -v,然后它说 gcc 不可用,并询问我是否要安装命令行 Apple Developer Tools。无需下载 Xcode。终端会话如下:

Pauls-MBP:~ paulhillman$ gcc -v
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Pauls-MBP:~ paulhillman$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

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:

Pauls-MBP:~ paulhillman$ gcc -v
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Pauls-MBP:~ paulhillman$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
玩物 2024-08-13 12:10:25

对于那些使用 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.

淡莣 2024-08-13 12:10:25

你安装了苹果开发者工具吗?
如果输入 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/

三人与歌 2024-08-13 12:10:25

现在有另一种方法可以通过 在 OS X 上安装 gcc 工具链osx-gcc-installer 这包括:

  • GCC
  • LLVM
  • Clang
  • 开发者 CLI 工具(清除、制作等)
  • DevSDK(标头等)

下载量为 282MB,而 Xcode 为 3GB。

There is now another way to install the gcc toolchain on OS X through the osx-gcc-installer this includes:

  • GCC
  • LLVM
  • Clang
  • Developer CLI Tools (purge, make, etc)
  • DevSDK (headers, etc)

The download is 282MB vs 3GB for Xcode.

满地尘埃落定 2024-08-13 12:10:25

您必须安装 OS X 安装磁盘中作为可选包提供的“开发人员工具”。

You will have to install the "Developer Tools" that are provided as optional packages in OS X installation disks.

下壹個目標 2024-08-13 12:10:25

对于 Xcode 4.1,您只需将 /Developer/usr/bin 添加到 PATH 环境变量即可。这很容易做到:

$ 导出 PATH=$PATH:/Developer/usr/bin

还要确保更新您的 ~/.bashrc (或 ~/.profile 或 ~/.bash_login)文件。

For Xcode 4.1 you can simply add /Developer/usr/bin to the PATH environment variable. This is easily done:

$ export PATH=$PATH:/Developer/usr/bin

Also be certain to update your ~/.bashrc (or ~/.profile or ~/.bash_login) file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文