How to open a window from mac terminal

14,639

Solution 1

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.

Solution 2

not sure if u're looking for something like this

open /path/to/some.app

Solution 3

I just tried

/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal &

and it did open a new window just fine.

OS X 10.7.4 here.

EDIT: Indeed if I try:

open /Applications/Utilities/Terminal.app

No new terminal window is opened

But,

open --new /Applications/Utilities/Terminal.app

works also, and is probably better than my first option because the job is not tied to the terminal you started the new terminal with.

Solution 4

I'd recommend either getting emacs via fink, or going to here: http://emacsformacosx.com/

This will allow you to install a local version of emacs that runs through the X server, and thus has the full GUI interface.

Solution 5

First, download a Mac OS/X emacs build from here: http://emacsformacosx.com/

Second, once it's installed, you can:

  1. Open it from the command line with open -a emacs
  2. Set it to run server mode in your .emacs init, and then at the command line type emacsclient foo for file foo.
Share:
14,639
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin about 2 years

    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!!