Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start "emacsformacosx" in terminal

Tags:

emacs

macos

I am using MAC OX 10.6 , and install the emacs from here http://emacsformacosx.com/

I want to know how to start it in terminal, so my ecb can open current directory

like image 719
why Avatar asked Feb 05 '12 14:02

why


People also ask

Is Emacs pre installed on Mac?

OS X comes with a preinstalled version of Emacs, but alas it is the outdated Emacs 22. Fortunately, obtaining a newer release is really simple. There are several popular ways to do it.

How do you get to the start of a command in Terminal Mac?

fn + left: to go to the beginning of the line.


2 Answers

It is actually quite easy, just run it from terminal like this:

/Applications/Emacs.app/Contents/MacOS/Emacs -nw 

the -nw option means to start emacs without the gui frame.

You can put the following in your shell (on my mac .zshenv) :

alias Emacs="/Applications/Emacs.app/Contents/MacOS/Emacs -nw" 

Then I just have two commands:

Emacs : for emacs version 24

emacs : for the apple version of emacs

Of course you can just alias the Emacs.app to emacs, but this allows me to customize the two differently - for instance Emacs 24 allows me to use list-packages and so forth. emacs 22 ignores most of this, so I can always revert to a 'bare metal' emacs if need be. Your usage may vary, but if you don't remember the arguments to emacs you can find them by doing this:

emacs --help 

Some interesting ones:

Emacs.app --fullscreen Emacs.app --line-spacing Emacs.app --vertical-scroll-bars 

More info here : http://www.gnu.org/software/emacs/manual/html_node/emacs/Option-Index.html#Option-Index

like image 170
Fr. John Jenkins Avatar answered Sep 29 '22 13:09

Fr. John Jenkins


The answer from @Toymakerii is a good one, but you might also consider adding:

export PATH=/Applications/Emacs.app/Contents/MacOS/bin:$PATH 

This way, you can use emacsclient to open files in an already-running Emacs instance:

emacsclient -t SOMEFILE   # Open SOMEFILE in a terminal frame emacsclient -c SOMEFILE   # Open SOMEFILE in a new graphical frame 

Depending on your Emacs version, you might need to put the following in your ~/.emacs.d/init.el (or ~/.emacs, if you're old-fashioned):

(require 'server) (unless (server-running-p)   (server-start)) 
like image 44
sanityinc Avatar answered Sep 29 '22 13:09

sanityinc