[已解決]如何使用chemacs从终端启动 emacs-mac port 的GUI ?

我想用chemacs方便地切换多套不同的配置,所以需要从命令行启动Emacs.app。

就我希望比如说在 终端输入 emacs --with-profile doom 就打开GUI的doom emacs ; 在终端输入 emacs --with-profile spacemacs 就打开GUI的spacemacs,诸如此类。

我用的emacs版本是railwaycat的emacsmacport,根据文档通过brew的方法安装,并软连接到Emacs.app。

brew tap railwaycat/emacsmacport
brew install emacs-mac
ln -s /usr/local/opt/emacs-mac/Emacs.app /Applications

然而命令行输入emacs默认启动的是tty版本,并不能启动GUI,我就很郁闷。(在spotlight里输入emacs也跳不出Emacs.app的选项,这就不提了)

根据Emacs Mac Port 文档,Emacs.app CLI starter可以用下面这里的方法

https://gist.github.com/railwaycat/4043945

里面是一个perl文件,据说

Paste into a file named emacs (or whatever you want the command to be) in a directory in your path (ahead of the location of the existing emacs command). Then chmod +x /path/to/emacs.

我有点没看懂, 这个文件是要干个啥啊 什么叫做"in a directory in your path (ahead of the location of the existing emacs command"啊? 这个是一步什么操作啊? 还有其他方法可以从CLI启动GUI Emacs吗?

真心请教各位。


补充一下 brew 安装 emacs-mac 成功后的message吧:

 This is YAMAMOTO Mitsuharu's "Mac port" addition to

GNU Emacs 27. This provides a native GUI support for Mac OS X

10.6 - 11. After installing, see README-mac and NEWS-mac

in /usr/local/opt/emacs-mac for the port details.

Emacs.app was installed to:

/usr/local/opt/emacs-mac

To link the application to default Homebrew App location:

ln -s /usr/local/opt/emacs-mac/Emacs.app /Applications

Other ways please refer:

https://github.com/railwaycat/homebrew-emacsmacport/wiki/Alternative-way-of-place-Emacs.app-to-Applications-directory

If you are using Doom Emacs, be sure to run doom sync:

~/.emacs.d/doom sync

For an Emacs.app CLI starter, see:

https://gist.github.com/4043945

==> **Summary**

= =b 突然发现这里有个类似主题

这里的方法可以用emacsclient启动GUI emacs,但我不知道要怎么可以跟 chemacs 一起用,以切换配置

找到解決方法了。brew安装的时候加一个选项

brew install emacs-mac --with-starter
--with-starter               emacs-mac:
                                       Build with a starter script to start emacs GUI from CLI