caldwell / build-emacs

Build scripts for www.emacsformacosx.com
http://www.emacsformacosx.com/about
GNU General Public License v3.0
364 stars 61 forks source link

How to run emacs from command line? #57

Closed chetstone closed 7 years ago

chetstone commented 7 years ago

I installed emacs 25.1.1 using brew cask install emacs. All went well (I can run it by launching from the finder) until I tried to create a symlink to run emacs from the command line. I tried

ln -s /Applications/Emacs.app/Contents/MacOS/Emacs /usr/local/bin/emacs

and when I run it I get a popup that says This application will not run on your computer. Sorry!

I discovered that when run from the finder it actually uses Emacs-x86_64-10_9 (I'm on Yosemite) so I tried

ln -s /Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_9 /usr/local/bin/emacs

and I get:

Warning: arch-dependent data dir '/Users/build/workspace/Emacs-Multi-Build/label/mavericks/emacs-source/nextstep/Emacs.app/Contents/MacOS/libexec/': No such file or directory
Warning: arch-independent data dir '/Users/build/workspace/Emacs-Multi-Build/label/mavericks/emacs-source/nextstep/Emacs.app/Contents/Resources/etc/': No such file or directory
Warning: Lisp directory '/Users/build/workspace/Emacs-Multi-Build/label/mavericks/emacs-source/nextstep/Emacs.app/Contents/Resources/lisp': No such file or directory
Error: charsets directory not found:
/Users/build/workspace/Emacs-Multi-Build/label/mavericks/emacs-source/nextstep/Emacs.app/Contents/Resources/etc/charsets
Emacs will not function correctly without the character map files.
Please check your installation!

What is the secret?

thanks

caldwell commented 7 years ago

Using an alias should work: alias emacs=/Application/Emacs.app/Contents/MacOS/Emacs. Of course that only works if you are typing emacs into a shell. If you want other programs to be able to launch Emacs (maybe it's in your EDITOR env var, for instance), you need to do something else. I use a little stub shell script (as described here):

#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"

I'm not going to close this bug though, because I think using a symlink should work. The launcher script should be able to detect that and act appropriately.

chetstone commented 7 years ago

Thanks! That works...

On Sun, Nov 27, 2016 at 7:01 PM David Caldwell notifications@github.com wrote:

Using an alias should work: alias emacs=/Application/Emacs.app/Contents/MacOS/Emacs. Of course that only works if you are typing emacs into a shell. If you want other programs to be able to launch Emacs (maybe it's in your EDITOR env var, for instance), you need to do something else. I use a little stub shell script (as described here https://emacsformacos.com/tips):

!/bin/sh

/Applications/Emacs.app/Contents/MacOS/Emacs "$@"

I'm not going to close this bug though, because I think using a symlink should work. The launcher script should be able to detect that and act appropriately.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/caldwell/build-emacs/issues/57#issuecomment-263166993, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7l11ZInqYCY0icxEm6oFMWkQgXH5HSks5rCjXwgaJpZM4K9QtW .