Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6974759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:16:47+00:00 2026-05-27T17:16:47+00:00

My .emacs contains (setenv PATH (concat .:/usr/texbin:/opt/local/bin (getenv PATH))) (setq exec-path (append exec-path ‘(.:/usr/texbin:/opt/local/bin)))

  • 0

My .emacs contains

(setenv "PATH" (concat ".:/usr/texbin:/opt/local/bin" (getenv "PATH")))
(setq exec-path (append exec-path '(".:/usr/texbin:/opt/local/bin")))

(add-to-list 'load-path "/usr/local/share/emacs/site-lisp")
(require 'tex-site)
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

/usr/texbin is where latex/pdflatex/.. are located.
/opt/local/bin/ is where gs can be found.

And yet when I run preview-at-point, which apparently needs both latex and gs, I get

Preview-DviPS finished at Thu Dec 22 11:25:46
DviPS sentinel: Searching for program: No such file or directory, gs

which means that latex could be found all right, but not gs.

I am not sure whether setting exec-path is necessary, perhaps PATH is enough, but I’ve set it as a debugging measure.

Why can emacs not find gs even though the directory it’s in is in both PATH and exec-path?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:16:48+00:00Added an answer on May 27, 2026 at 5:16 pm

    If you’re setting $PATH inside your Emacs, you might well be on OS X. GUI applications are not started via your shell, so they see different environment variables.

    Here’s a trick which I use to ensure the $PATH inside Emacs is the same one I see if I fire up a terminal (but see “update” below):

    (defun set-exec-path-from-shell-PATH ()
      "Set up Emacs' `exec-path' and PATH environment variable to match that used by the user's shell.
    
    This is particularly useful under Mac OSX, where GUI apps are not started from a shell."
      (interactive)
      (let ((path-from-shell (replace-regexp-in-string "[ \t\n]*$" "" (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
        (setenv "PATH" path-from-shell)
        (setq exec-path (split-string path-from-shell path-separator))))
    

    Then simply call the set-exec-path-from-shell-PATH function, perhaps from your Emacs init file. I keep that code on github, BTW.

    Update: this code has now been improved and published as an elisp library called exec-path-from-shell; installable packages are available in MELPA.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read the page in Emacs wiki which contains a list of session
When trying to kill a buffer that contains changes in Emacs, the message: Buffer
Emacs does not recognize my correct Python path. I think it is a general
If .emacs contains the following two lines (set-face-foreground 'modeline #000000) (set-face-background 'modeline #00FFFF) then
Suppose I have an emacs buffer which contains times in the format minutes'seconds'' and
Emacs puts backup files named foo~ everywhere and I don't like having to remember
Emacs has a useful transpose-words command which lets one exchange the word before the
Emacs edits my .emacs file whenever I use the customization facility, or when I
Emacs has Paredit which actively prevents you from typing unbalanced parentheses (short of C-Q
Emacs and Java change propagation Hi, I'm mostly used to code in IDE like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.