JuanPabloMF
JuanPabloMF

Reputation: 497

Setting up emacsformacosx as default from command line

I tried to set emacsformaxosx as the emacs command called from the command line (in order to install mu4e) by putting the following inside /usr/bin/emacs:

#!/bin/bash
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"

When calling . /usr/bin/emacs emacs get launched but when calling which emacs I get nothing in my prompt, neither do I with just emacs. whereis emacs seem to find well that emacs is in /usr/bin/emacs.

Upvotes: 0

Views: 105

Answers (1)

Steve Vinoski
Steve Vinoski

Reputation: 20014

You need to run

chmod a+x /usr/bin/emacs

to make the /usr/bin/emacs script executable.

The reason it works with the command

. /usr/bin/emacs

is that in that case, your shell sources the contents of the /usr/bin/emacs script and directly runs each command it finds there.

Also, note that since the shell script has nothing else to do after running emacs, you could add the command exec in front of the emacs command in the script so that the emacs process replaces the shell script process:

#!/bin/bash
exec /Applications/Emacs.app/Contents/MacOS/Emacs "$@"

Upvotes: 1

Related Questions