这是针对2019年4月的更新,Mac OSX mojave 10.14.4 reddit上的讨论
看起来在Hombrew中并没有可用的cocoa选项以及--head。因此你可以:
brew cask install emacs #is the preferred from emacs wiki
brew install --cask emacs #using new cask syntax
如果你想在不使用cask的情况下从brew进行相同的设置,可以使用以下命令:
emacs-head
brew tap daviderestivo/emacs-head
brew install emacs-head --HEAD --with-cocoa --with-librsvg --with-imagemagick@7 --with-json --with-multicolor-fonts --with-no-frame-refocus --with-mailutils --with-dbus --with-modules
获取这个
ls -l $(which emacs)
lrwxr-xr-x 1 toni admin 45 23 abr 19:26 /usr/local/bin/emacs -> ../Cellar/emacs-head/HEAD-259dfd2_1/bin/emacs
然后你可以使用osascript来进入Spotlight和应用程序:
osascript -e 'tell application "Finder" to make alias file to POSIX file "/usr/local/Cellar/emacs-head/HEAD-259dfd2_1/Emacs.app" at POSIX file "/Applications"'
下面的内容已经过时,但仍然包含更多信息:
这是2017年10月的更新。现在,易于安装的emacs正在使用brew cask。
brew cask install emacs
这样做很好,但我在使用gnutls和安装最新的org(9.1.6)时遇到了问题,不过之前都运行良好。
如果您想要传统方式并将emacs更好地集成到您的系统中,或者想要获取夜间版本,您可以使用以下命令进行安装:
brew install emacs --HEAD --with-cocoa --with-gnutls --with-librsvg --with-imagemagick@6 --with-mailutils
--HEAD 不是必需的,现在(2018年1月23日)可以获取 Emacs 27,最新版本已经不需要 HEAD。
然后你应该将其用于 Spotlight:
brew linkapps emacs
rm /Applications/Emacs.app
osascript -e 'tell application "Finder" to make alias file to POSIX file "/usr/local/opt/emacs/Emacs.app" at POSIX file "/Applications"'
最后,看一下
emacs wiki。
Homebrew has Emacs 25.3 as of October 2017.
Cask homebrew installation
Homebrew now recommends to use the cask version with the following
message: “Please try the Cask for a better-supported Cocoa version”
To install the cask version:
brew cask install emacs
This installs a pre-built package from https://emacsformacosx.com/
Standard homebrew installation
If you prefer not to run the cask version, you can still use the old
homebrew recipe.
A Cocoa-specific Emacs.app can be built using the --with-cocoa switch.
A version supporting X11 can be built using the --with-x switch. Note that this version will not have all of the features of the Cocoa
version; use only if necessary.
Other options include:
--keep-ctags Don’t remove the ctags executable that emacs provides. Use of this flag is not recommended Instead, use brew
install ctags after installation.
--srgb This option will enable sRGB colors when using Cocoa.
To install using the --with-cocoa switch, one simply uses:
brew install --with-cocoa emacs
to get some “pretty” colours add the --srgb switch:
brew install --with-cocoa --srgb emacs
and finally link it to your Applications folder:
brew linkapps emacs
This creates a symlink and not an alias. So Spotlight may not find it
(tested on macOS Sierra 10.12.2). Spotlight indexes symlinks to files
that are treated as system files, but it doesn’t show them in the GUI.
It does show aliases though, so you could just command-option-drag
/usr/local/Cellar/emacs/*/Emacs.app to /Applications/ from Finder. Or:
$ osascript -e "tell application "Finder" to make alias file to
(POSIX file "/usr/local/Cellar/emacs-plus/25.3/Emacs.app") at POSIX
file "$HOME/Applications""
After installation, using the emacs command in the terminal or shell
will run the -nw version of Emacs. If you want to run the Cocoa
version using this command, you simply add a line to your
.bash_profile. Emacs-Plus version in tap
To instead use the emacs-plus version, which is like regular homebrew
emacs but with some configuration options enabled,
brew tap d12frosted/emacs-plus brew install emacs-plus
Mitsaharu version in tap
To instead use the Yamamoto Mitsuharu version of Emacs 25.2 (with more
mac-specific features):
brew tap railwaycat/emacsmacport brew install emacs-mac
and finally link it to your Applications folder:
brew linkapps emacs-mac
emacs
是一个包装脚本,它明确地想要运行/usr/local/Cellar/emacs/24.5/Emacs.app/Contents/MacOS/Emacs
。运行which emacs
应该会告诉你那个包装脚本在哪里。 - phils