【问题标题】:installing "make" on Mac在 Mac 上安装“make”
【发布时间】:2012-07-15 18:32:16
【问题描述】:

我正在尝试使用本教程在 Mac 上安装 Memcached: http://tugdualgrall.blogspot.de/2011/11/installing-memcached-on-mac-os-x-and.html 但是当我尝试 ./configure 它说: 配置:错误:在 $PATH 中找不到可接受的 C 编译器 当我尝试让它说: 制作 sh:make:找不到命令 sh-3.2# yum install make sh: yum: 找不到命令 sh-3.2# apt-get install make sh: apt-get: 找不到命令

我必须提到我有 Xcode,但它仍然无法正常工作。 我在 Mac 上真的很新,所以请考虑到这一点:) 我将衷心感谢您的帮助 谢谢!

【问题讨论】:

  • Xcode 应该为您提供make 和相关工具。 printenv PATH | tr ":" "\n" 返回什么?
  • 它给出: /opt/local/bin /opt/local/sbin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/X11/bin /usr/本地/git/bin
  • 最新版本的 Xcode 将他们的工具安装在包本身中,例如/Applications/Xcode.app/Contents/Developer/usr/bin。试着把它放在你的$PATH

标签: macos makefile memcached installation


【解决方案1】:

如果您有 Xcode 4.3 或更新版本,则默认不安装命令行工具,例如 make。在 Xcode 首选项中,转到“下载”选项卡,然后在“组件”下按“命令行工具”旁边的“安装”按钮。成功下载并安装命令行工具后,您还应该在终端中键入以下命令,以确保您的所有 Xcode 命令行工具都切换为使用 4.3 版本:

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

一切都安装成功后,您应该会在 /usr/bin 中看到 make 和其他命令行开发工具。

【讨论】:

  • 完美!非常感谢托里!
  • 为什么它不适合我?仍然是它的说法:-bash: make: command not found
  • @SazzadTusharKhan - 试试这个:daigo.org/2012/10/… - tl;dr: Xcode > Preferences > Downloads > 单击命令行工具旁边的“安装”。我目前安装了 Xcode 4.5.3,在我从 Lion 更新到 Mountain Lion 后需要执行此操作。
  • @torrey.lyons:我的 Mac 上当前的 make 版本是 3.81。如何升级到 4.1?谢谢
  • @LionLai Apple 发布的最新版本是 3.81,可能是由于许可问题。您必须自己安装 GNU Make 才能获得 4.1。有关详细信息,请参阅此问题stackoverflow.com/questions/43175529/…
【解决方案2】:

torrey.lyons 的回答中,Xcode --> Preferences --> DownloadsCommand Line Tools 下说:

安装之前,请注意,您可以在终端中使用 XCRUN 工具来启动编译器和其他嵌入在 Xcode 应用程序。 使用 XCODE-SELECT 工具定义哪个版本 Xcode 处于活动状态。在终端中键入“man xcrun”以找出答案 更多。

因此,我能够使用命令 xcrun make 运行 make 工具。

【讨论】:

    【解决方案3】:

    Mac OS 11 (Big Sur) 发生了变化。现在有一个命令行工具包。在 Apple 的开发者网络上搜索“Xcode 12.5.1 的命令行工具”(或更新版本)。

    【讨论】:

      猜你喜欢
      • 2012-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-15
      相关资源
      最近更新 更多