Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a window from mac terminal

this is the first time I ask on stackoverflow because I can't find the answer anywhere. I use emacs to write all my code and I just switched from ubuntu to mac os. One problem has been bothering me: How could you open emacs window from mac terminal just like you would open firefox window from terminal on Linux system? I know the way it works for Linux system is that, whenever you type a command from terminal, the terminal search for the binary in you PATH and execute it. Is it the case for Mac that you can only open applicaiton in window form under "/Application" directory and all binaries opened from terminal are in non-window form? Big thanks!!

like image 617
user1655257 Avatar asked Sep 07 '12 16:09

user1655257


1 Answers

The pre-installed Emacs that comes with OS X is built without the GUI. Hence

$ emacs   # in the shell/terminal

will NOT open a graphical window, and instead will open up the text/terminal version instead. Note that this version (installed at /usr/bin/emacs) is also old, and is at 22.1.1 in Mountain Lion.

To get the behavior you desire (and also get the latest version of Emacs as a bonus), you can download the latest Emacs build. This is available at various places, including http://emacsforosx.com/.

Most of these pre-built Emacs are installed under /Applications, and in order to invoke from the terminal, you will need to specify the full path to the binary, which usually is:

 /Applications/Emacs.app/Contents/MacOS/Emacs

You can create a simple alias to this binary in your .bashrc as:

 alias emacs=/Applications/Emacs.app/Contents/MacOS/Emacs

and then invoke emacs in its full glory from the command line.

like image 115
Anupam Avatar answered Oct 16 '22 15:10

Anupam