tags:

views:

58

answers:

2

Hey,

I'm a long time GNU/Linux user. Even though OSX is much like GNU/Linux is many ways, it differs in some. For example, when I install Firefox I expect to be able to run firefox in a shell to start it. But not in OSX.

That gives me some trouble when running Emacs batch scripts. Lets say I have this script:

#!/usr/bin/env emacs --script

(message "Hello world!")

I can run it without any problems. But I'll be using the emacs builtin to OSX. And most of the times that's not possible since the Emacs version is pretty old.

Installing Emacs from scratch made it possible to create a Bash-script, which called some emacs binary file.

But installing Emacs from http://emacsformacosx.com/ I can not make this work. Can anyone think of a solution for this?

+1  A: 

Yes, you dig out the path to the Emacs app emacs.

I've got X EMACS on my machine (not an emacs app), but the path will be something like

/Applications/Emacs.app/Contents/bin/emacs

You can find the exact path with ls from the command line.

Charlie Martin
Except that there's no such file. I've already checked that. That's how I did it when I compiled from source.
rejeep
rejeep, if there's no such file you aren't looking in the right place. Assuming you compiled from source with the next-step flag and built an app with make install, there is a directory *somewhere* named *Emacs.app* The contents of that package will have, somewhere in some subdirectory, a bin directory which contains the EMACS executable.If you built it for X as I did, there there is a directory with your emacs executable; by default it's /usr/local/bin. use that path.But if emacs *runs*, then that executable is SOMEWHERE on your system.
Charlie Martin
Worst come to worst, execute `sudo find / -name emacs -type f`. Your emacs executable will be there somewhere.
Charlie Martin
Well, the point is that I'm not compiling from source. When I do that it's fine. It's when I get the dmg-file I can't find any binary.
rejeep
Good. That means you aren't running emacs at all and the problem is solved.Seriously, *DO IT FROM THE COMMEND LINE*. Find your Emacs.app. It's a directory (that's all a Mac app is.) cd into the directory and start exploring. It's there. Honest.
Charlie Martin
+3  A: 

(1) Launch Emacs.

(2) Open Activity Monitor. (Applications > Utilities > Activity Monitor)

(3) Find Emacs in the list of running processes, under "Process Name".

(4) Select it.

(5) Choose "Inspect" from the Toolbar.

(6) In the window that opens, choose the "Open Files and Ports" tab.

(7) The name of the Emacs executable currently running should be the second line in the list. (The first line should be /Users/yourusername.) In my case it's /Applications/Emacs.app/Contents/MacOS/Emacs, which is pretty standard.

Kieran
Ahh... When I did like Charlie recommended with find looking for Emacs, of course (as a GNU/Linux) user, I searched for emacs with a lowercase e. I found the binary called Emacs now. Thanks!
rejeep
This also works for firefox. You can run /Applications/Firefox.app/Contents/MacOS/firefox-bin from the command line.
KeithB
If firefox is your default browser, the 'open' command should work to launch firefox with a specific URL. Otherwise, might be worth creating a symbolic link or alias for 'firefox' to the binary. It will accept the same parameters as the Linux version.
JulesLt