Configure Emacs's PATH environment in Mac OS X

Configure Emacs's PATH environment in Mac OS X


Table of Contents

  • Background
  • Why did that sad thing happen?

1 Background

Yesterday, I wanna send a love letter to a chick who I am chasing on-line. So I decided to send this letter by my favorite email client GNUS in my favorite editor Emacs to show my passion and love, but sad things happened(Seriously, Should I still being single and lonely?) , I got following errors:
  • My customized email signature corrupted, which supposed to attach a joke and an ASCII art. Following is the error message, if I sent those error message to a girl, I must be out the game, right?

/bin/bash: fortune: command not found /bin/bash: cowsay: command not found

  • I can not send emails in GNUS anymore.
smtpmail-send-it: Sending failed: 530 5.7.0 Must issue a STARTTLS command first. y9sm60423107pas.10 - gsmtp
  • Although I have another puzzle which can be classified as same kinds of problem, In eshell-mode, I can not found the right command. It looks like PATH variable is broken.
which: no gnutls-cli in (/usr/bin:/bin:/usr/sbin:/sbin)

2 Why did that sad thing happen?

The above errors are caused by three environment variables: exec-path, PATH, and eshell-path-env. After reading its source code, I found the correct configuration.

;; GNUS cann't send email error
(add-to-list 'exec-path "/opt/local/bin/")

;; shell-command-to-string error
(setenv "PATH" 
        (concat "/opt/local/bin/:"
                (getenv "PATH")))

;; eshll-mode command cann't found
(eval-after-load 'esh-util
  '(progn 
     (setq eshell-path-env (concat "/opt/local/bin/:" eshell-path-env)
           )))

Now, problem solved, and case close. I record this, in case someone else has the same problem, especially when you are sending a love letter.

Comments

Popular posts from this blog

Bluedroid stack in android

How to setup a NAT server?

Network programming in elisp