Macos – Send command to terminal from emacs

emacsmacos

I'd like to run a command in a running iterm tab (or terminal, whatever) from elisp. I don't want to use a terminal emulator running under emacs, since I've yet to find one that handles output as well as a standalone terminal emulator.

Is this possible?

I basically need this, but for a process that isn't running under emacs:

(term-simple-send proc "echo hello")

Best Answer

If you are really just concerned about output quality, why not call uxterm with the -hold option as so?

(defun external-xterm-shell-command (COMMAND)
  "Run a terminal command in an external xterm window."
  (interactive "sShell Command: ")
  (shell-command (concat "uxterm -hold -e " COMMAND)))
Related Question