3

Does anyone know any tricks for launching emacs with GUI on OS X with the standard command emacs?

I'm a ten year Linux user and thought I would buy a Mac for a while to stay diverse. I can open files via emacs now with open file.txt, but that wont allow me to use debugging mode.

slhck
  • 235,242

5 Answers5

2

You could create an alias such as:
alias emacs = "open -a ProgramName"

Yitzchak
  • 4,474
  • 7
  • 28
  • 44
2

If the following is within your realm of expertise it may be worth doing:

  1. Create a directory under /Users/Fred, for instance, /Users/Fred/bin where you store your own executable programs.

  2. Ensure that MacOS knows about your executable directory at login by editing the settings in ~/.MacOS/environment.plist .

  3. Create a file called ~/bin/emacs . In it put the lines

    #!/bin/sh
    exec /Applications/Emacs.app/Contents/MacOS/Emacs $* 
    
  4. Ensure that the file has execute permission: chmod a+x ~/bin/emacs

  5. Depending on your success with 2 (and whether or not you have logged out and in) you should be able to execute emacs with either just emacs or [worst case] with ~/bin/emacs

  6. The advantage of this approach over using open is that you can now use command lines like sudo emacs --user Fred /etc/something-owned-by-root. The --user Fred being useful if you have heavily customized emacs.

1

Are you using bash? With this bash function definition in your .bashrc (or whatever file you source your bash aliases from), 'emacs <stuff more stuff>' will do what you expect, including leaving your terminal back at the prompt immediately after launching emacs.

emacs() { /Applications/Emacs.app/Contents/MacOS/Emacs "$@" & }
JRobert
  • 7,134
0

Have you tried Aquamacs? It has command-line kit, and then you can use it from the command line.

Dror
  • 1,928
0
  1. Launch Emacs after each reboot. Never quit. (Only reboot your computer when you an OS update forces a reboot).
  2. Make sure that you start Emacs server when Emacs launches by putting (server-start) in your .emacs file.
  3. Use the command line utility emacsclient -n to open files in Emacs.

Optional step 4 - create an alias to make it shorter:

alias em='emacsclient -n'
Doug Harris
  • 28,397