Steps to reproduce
- Install any third-party plugin that executes system commands from Obsidian (e.g., Templater or Obsidian Git)
- Try to execute code that uses a package that was installed via Homebrew (e.g., writing a user function in Templater or using
git-lfs
with Obsidian Git) - Obsidian will not be able to find the package, and will throw an error.
Expected result
I expect to successfully run the system commands using the packages I downloaded with Homebrew.
Actual result
With both Templater and Obsidian, I get the error command not found
or PACKAGE not found
where PACKAGE is whatever I was trying to use (git-lfs
, fx
, tldr
, anything I installed with Homebrew).
This error occurred on both the main Obsidian version and the Insider version.
Environment
- Operating system: MacOS Monterrey
- Debug info:
SYSTEM INFO:
Obsidian version: v0.13.21
Installer version: v0.12.15
Operating system: Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64 21.2.0
Login status: logged in
Catalyst license: supporter
Insider build toggle: on
Live preview: on
Legacy editor: off
Base theme: dark
Community theme: Minimal
Snippets enabled: 5
Safe mode: off
Plugins installed: 18
Plugins enabled: 17
1: Hider
2: Find unlinked files and unresolved links
3: Tag Wrangler
4: Calendar
5: Dataview
6: Periodic Notes
7: Templater
8: Style Settings
9: Tag Page Preview
10: Sliding Panes (Andy’s Mode)
11: TagFolder
12: Contextual Typography
13: Metadata Extractor
14: Advanced URI
15: Obsidian Git
16: Advanced Tables
17: Tasks
Additional information
This has been discussed on Obsidian Git’s issue page, and I also opened an issue with Templater.
My guess is that it’s the same underlying problem that Obsidian does not include /usr/local/bin
on the path when it executes code, and, when Homebrew installs packages, it places the symlinks to those packages in /usr/local/bin
.
There was also an old forum post describing this problem that is now locked and wasn’t resolved.
Work-Arounds
For Obsidian Git, I followed the steps discussed in that issue and added PATH=$PATH:/usr/local/bin
to the top of all of the hooks added by git-lfs
. I also updated my global .gitconfig
to refer to /usr/local/bin/git-lfs
instead of just git-lfs
. With those changes, I was able to use Git LFS with Obsidian Git.
For Templater, I defined my functions as bash scripts, and I included PATH=$PATH:/usr/local/bin
at the top of each script. From there, I was able to write a user-defined function in Templater to run my bash script successfully.