Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a symbolic link to use emacs in Mac OS

I want to create a command line executable which will spawn an emacs window/application. I searched on the internet and found that the emacs shipped with Mac is not supported in X11 window So, I downloaded the latest emacs from http://emacsformacosx.com/ and installed it in my mac.
Then I go to the /usr/bin directory and create a symbolic link like this:

sudo ln /Applications/Emacs.app/Contents/MacOS/Emacs xemacs

when I run this symblolic link by ./xemacs it says(. means /usr/bin):

Warning: arch-dependent data dir (/Users/david/src/emacs-dev/ftp-versions/emacs-24.2/nextstep/Emacs.app/Contents/MacOS//libexec/emacs/24.2/x86_64-apple-darwin/) does not exist. Warning: arch-independent data dir (/Users/david/src/emacs-dev/ftp-versions/emacs-24.2/nextstep/Emacs.app/Contents/Resources/share/emacs/24.2/etc/) does not exist. Error: charsets directory not found: /Users/david/src/emacs-dev/ftp-versions/emacs-24.2/nextstep/Emacs.app/Contents/Resources/share/emacs/24.2/etc/charsets Emacs will not function correctly without the character map files. Please check your installation!

But if I run the Emacs binary in directory /Applications/Emacs.app/Contents/MacOS/ it starts the application without any error.

Any one knows how to solve this problem?

like image 785
Peiti Li Avatar asked Oct 27 '25 05:10

Peiti Li


2 Answers

Up to this point I think the best way is to create an executable script under /usr/bin which will execute the binary file /Applications/Emacs.app/Contents/MacOS/Emacs. The reason I didn't use "open" command is that I need to use some Emacs binary arguments. Compared to "open" this method can spawn multiple instance of emacs.

The script is :

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

Then make it executable by doing chmod +x script.sh

then make the symlink

ln -s "/usr/local/bin/script.sh" /usr/local/bin/xemacs

like image 51
Peiti Li Avatar answered Oct 29 '25 19:10

Peiti Li


You could use an alias: alias emacs="open -a Emacs --args <youroptions>. The option --args allows you to pass options directly to emacs (e.g., -q avoids the evaluation of the init script).

like image 27
Matthias Avatar answered Oct 29 '25 18:10

Matthias



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!