I am using Emacs 25.2 with Zsh; and I have added the following to my init.el file to set both the Path and exec-path.

;; Set shell path
(defun set-shell-path ()
  (let ((shell-path (shell-command-to-string "$SHELL -i -c 'echo $PATH'")))
    (setenv "PATH" shell-path)
    (setq exec-path (split-string shell-path path-separator))))

(when (display-graphic-p)

When the above executes it results in the error:

("compaudit" "133" "command not found" "getent compaudit" "open terminal failed" ...)

My zshrc includes the following:

autoload -U compinit && compinit -i
# Launch Tmux.
if command -v tmux &> /dev/null; then
  [[ ! $TERM =~ dumb ]] && [[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux -u

Suggestions on how I can/should solve this error are appreciated? Thanks.

1 Answer 1


Whatever compinit is, apparently it fails if there's no terminal. Since you're running this shell command inside emacs, there's not going to be a terminal.

Also, exec-path is already initialized from your PATH when emacs starts up; none of this should be necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.