首页 > 解决方案 > 无法在 Homebrew 中安装 emacs

问题描述

$ brew install emacs
Updating Homebrew...
Warning: Treating emacs as a formula. For the cask, use homebrew/cask/emacs
==> Downloading https://homebrew.bintray.com/bottles/emacs-27.1.mojave.bottle.1.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/edc19e2cbf4d5136f0e31adfb9c57161b65dd8163f861a92e10bfd617d1d611c--emacs-27.1.mojave.bottle.1.tar.gz
==> Pouring emacs-27.1.mojave.bottle.1.tar.gz
==> emacs cask is installed, skipping link.
==> Caveats
To have launchd start emacs now and restart at login:
  brew services start emacs
Or, if you don't want/need a background service you can just run:
  emacs
==> Summary
  /usr/local/Cellar/emacs/27.1: 4,009 files, 104.0MB
==> Upgrading 1 dependent:
cask 0.8.4 -> 0.8.5
==> Upgrading cask 0.8.4 -> 0.8.5
==> Downloading https://github.com/cask/cask/archive/v0.8.5.tar.gz
==> Downloading from https://codeload.github.com/cask/cask/tar.gz/v0.8.5
######################################################################## 100.0%
Error: An exception occurred within a child process:
  RuntimeError: /usr/local/opt/emacs not present or broken
Please reinstall emacs. Sorry :(

如何解决这个问题?

标签: installationhomebrew

解决方案


通过查看输出,似乎确实安装了 emacs:

==> Summary
  /usr/local/Cellar/emacs/27.1: 4,009 files, 104.0MB

您应该可以立即使用它。

如果你喜欢GUI 版本,你可以安装它:

brew install --cask emacs

问题

Error: An exception occurred within a child process:
  RuntimeError: /usr/local/opt/emacs not present or broken
Please reinstall emacs. Sorry :(

这是另一个工具 ,cask无法安装:

  • 它无法在/usr/local/opt/emacs.
  • Homebrew 将其安装在/usr/local/Cellar/emacs/27.1.

修复

您可以通过以下方式修复它:

  1. /usr/local/opt/(推荐)在emacs 目录中创建符号链接
$ brew link --overwrite emacs  # if it complains about relinking, run brew unlink emacs && brew link emacs instead
$ brew install cask
  1. (替代)如果上一点没有帮助,安装时忽略依赖项cask
$ brew install cask --ignore-dependencies

请让我知道它是否有帮助


推荐阅读