I am a new iMac user. I have extensive experience with Linux on a PC. I downloaded latest version of emacs to the Applications folder. I want to invoke emacs from the command line. However, the default path for emacs is /usr/bin/emacs. what is the best practice for adding the new emacs to the path? I am tempted to create a ~/bin directory and a link to the new emacs and adding ~/bin to the beginning of my path. This is how we did things in our software development environment on linux PC's
You can find precompiled versions of emacs and Emacs. app at http://emacsformacosx.com/. Versions of macOS prior to 10.15 Catalina include a copy of GNU Emacs 22 without GUI support compiled in and thus Emacs is automatically available on all but the most recent versions of macOS via the terminal.
Emacs can be installed on MacOS using Homebrew. The Emacs for OSX website also provides universal binaries.
To enter Emacs, type emacs at the shell prompt. When you want to leave Emacs for a short time, type a C-z and Emacs will be suspended.
Emacs has two versions: the GUI version which runs in a separate window and has buttons and menus for common functions, and the text-based version which runs in your console window.
Best way is to use Homebrew and use
brew install emacs --cocoa
so you have a easy to update emacs installation. The Cocoa will make sure you have your mac keybinding working before emacs. Make the binary run at startup as a daemon (because it starts up not very fast), for instance:
/usr/local/Cellar/emacs/23.2/Emacs.app/Contents/MacOS/Emacs --daemon
And make an script to the emacsclient command and saved it to /bin/emacs file (don't forget to make it executable):
#!/bin/bash
exec /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -c "$@"
so when you fire up at bash "emacs something.txt" the already running emacs daemon opens it instantly. You can also extend it to open Emacs if the daemon is not running!
I tested it on the latest emacs 23.2, some features are not present on early versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With