emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Proposal to let Emacs to properly capture $PATH on macOS .


From: slb zetrov
Subject: Proposal to let Emacs to properly capture $PATH on macOS .
Date: Thu, 21 May 2020 03:21:39 -0400

Hi,
 
I am totally new here, and I am sorry to propose something related to a non-free system.
 
On macOS, if the default Emacs build launched by click "Emacs.app" from Finder or Launchpad, the Emacs will not get the environment variables (i.e. $PATH and  $PYTHONPATH etc.)  
 
The direct result is that any package that invoke an eternal command cannot find the program (e.g. SLIME invoke a sbcl, AucTex invoke a pdflatex or invoke gcc/gdb/make directly).
 
The primary reason is that about 10 years ago the Apple disabled the "dot app" to get environment variables.
 
This also affect a lot of software in the past, including R Lang, Eclipse, here are some related discussions:  
  1. https://apple.stackexchange.com/questions/51677/how-to-set-path-for-finder-launched-applications
  2. https://stackoverflow.com/questions/829749/launch-mac-eclipse-with-environment-variables-set/36282543#36282543
  3. https://github.com/eclipse/ice/issues/288
  4. https://stackoverflow.com/questions/48084679/why-do-which-and-sys-which-return-different-paths#comment83144504_48084679
The current solution for Emacs users is to install a completely avoidable and unnecessary package (exec-path-from-shell) https://github.com/purcell/exec-path-from-shell/
 
By properly (trickily)  including the $PATH, Emacs' users, especially new ones, will have improved user experience by eliminating the need to search "Why a package cannot find X executable" "Why the shell inside Emacs cannot find my programs" and waste time on install that unnecessary patchy package. Besides, the unnecessary complexity of exec-path-from-shel can also be avoided.
 
The most direct and simple solution is to use the existing shell (zsh or bash). This can be done by include a shell script inside the Emacs.app with something like this
 
#===================
#!/bin/shell script
source .zshrc and .bash_profile
execuate the Emacs binary inside the Emacs.app
#==================
 
However, there should be a better approach than this.
 
I want to make this simple patch and I think it is beneficial :)
 
Sincerely,
Zetrov J
 
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]