MacOS下安装m4报错

在macos中,使用"brew install m4"安装m4,安装成功之后执行m4,会如下报错:
xcode-select: Failed to locate ‘m4’, requesting installation of command line developer tools.

家人们有没有人知道这是什么错

1 Like

执行 xcode-select --install 看看

3 Likes

xcode-select: note: Command line tools are already installed. Use “Software Update” in System Settings or the softwareupdate command line interface to install updates
貌似他让我升级,但是系统里没有更新

1 Like

执行

brew info  m4 

看看啥输出

我的输出

==> m4: stable 1.4.19 (bottled) [keg-only]
Macro processing language
https://www.gnu.org/software/m4
/opt/homebrew/Cellar/m4/1.4.19 (13 files, 742.3KB)
  Poured from bottle using the formulae.brew.sh API on 2023-06-14 at 19:35:47
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/m/m4.rb
License: GPL-3.0-or-later
==> Caveats
m4 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have m4 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/m4/bin:$PATH"' >> ~/.zshrc

也行你需要执行下

echo 'export PATH="/opt/homebrew/opt/m4/bin:$PATH"' >> ~/.zshrc
2 Likes

谢谢佬,这个思路是对的。我看了一下所有brew安装的工具的本体都放在/opt/homebrew/Cellar/里,会通过软链的形式链接到/opt/homebrew/bin/里面,但是我安装完却没有软链接生成,暂时还不清楚是什么原因。

  • echo ‘export PATH=“/opt/homebrew/opt/m4/bin:$PATH”’ >> ~/.zshrc
  • ln -sf /opt/homebrew/Cellar/m4/1.4.19/bin/m4 /opt/homebrew/bin/m4

应该都可以解决问题

1 Like

From #develop:qa to 开发调优

1 Like