phibr0 / obsidian-open-with

MIT License
35 stars 3 forks source link

Not working on macOS? #9

Closed huyz closed 2 years ago

huyz commented 2 years ago

Can someone help me try to get this to work on macOS. I want to be able to edit some docs with MacVim.

So I have the path set as /opt/homebrew/bin/mvim but nothing happens and there are no errors in the Web console either.

huyz commented 2 years ago

I figured it out.

After debugging the plugin, I learned that this was invoking:

open -a "/opt/homebrew/bin/mvim" "/Users/huyz/Documents/Vaults/Vault/Obsidian playground.md" --args ""

which gives the error:

The application /opt/homebrew/bin/mvim cannot be opened for an unexpected reason, error=Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x60000076c780 {Error Domain=NSPOSIXErrorDomain Code=111 "Unknown error: 111" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}

Google searches led to:

which suggest that this is a permission issue, perhaps specific to the M1 mac. It seems that using the Obsidian GUI app to invoke a CLI script which itself invokes a GUI app doesn't play well with the permission system.

So I tried /Applications/MacVim.app/Contents/MacOS/MacVim and that worked.

So I guess there just needs to be a warning added to the README about that, and perhaps providing the example /Applications/MacVim.app/Contents/MacOS/MacVim instead of /opt/homebrew/bin/mvim