Skip to content

Instantly share code, notes, and snippets.

@russellmcc
Last active January 15, 2025 20:40
Show Gist options
  • Save russellmcc/6415142 to your computer and use it in GitHub Desktop.
Save russellmcc/6415142 to your computer and use it in GitHub Desktop.
How to use fish shell paths from emacs
(let*
((fish-path (shell-command-to-string "/opt/homebrew/bin/fish -i -c \"echo -n \\$PATH[1]; for val in \\$PATH[2..-1];echo -n \\\":\\$val\\\";end\""))
(full-path (append exec-path (split-string fish-path ":"))))
(setenv "PATH" fish-path)
(setq exec-path full-path))
@yurighensev
Copy link

yurighensev commented Jul 23, 2021

Thanks for sharing.
Had to tweak it to merge with current exec-path to have it working for me. Probably needed because I'm using spacemacs and it has its own (spacemacs/load-spacemacs-env) loaded beforehand.

  (let*
      ((fish-path (shell-command-to-string "/usr/bin/fish -i -c \"echo -n \\$PATH[1]; for val in \\$PATH[2..-1];echo -n \\\":\\$val\\\";end\""))
       (full-path (append exec-path (split-string fish-path ":"))))
    (setenv "PATH" fish-path)
    (setq exec-path full-path))

@russellmcc
Copy link
Author

Glad this helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment