Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs on OS X 10.6

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

like image 497
Jim Avatar asked Aug 17 '10 17:08

Jim


People also ask

How do I get Emacs on OSX?

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.

Is Emacs available for Mac?

Emacs can be installed on MacOS using Homebrew. The Emacs for OSX website also provides universal binaries.

How do I get Emacs in terminal?

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.

Is Emacs a GUI?

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.


1 Answers

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.

like image 169
Henry Mazza Avatar answered Sep 20 '22 17:09

Henry Mazza