Unable to open a searched file on macOS
Opened this issue ยท 5 comments
Describe the bug
I search for some using rga-fzf foo
and then do a enter on the file name in the results sidebar. However I am getting an error - Error: No such file or directory (os error 2)
To Reproduce
Attach example file:
Run command:
Output
Screenshots
If applicable, add screenshots to help explain your problem.
Operating System and Version
MacOS Sonoma 14.1.2
Output of rga --version
ripgrep-all 0.10.6 - Installed via homebrew
I can confirm these same errors with ripgrep-all
0.10.6, installed via Homebrew on MacOS Sonoma 14.7. I had to revert to the shell functions listed in the wiki.
It's hardcoded to try Evince
, and xdg-open
barring that:
ripgrep-all/src/bin/rga-fzf-open.rs
Line 16 in dcbcb71
It's needs to use open
on MacOS instead. You can either install Evince, alias it, use a modified script from the wiki or change the code yourself and recompile.
the rga-fzf-open script is pretty hacky in general. I should probably remove or replace it with something more clean / configurable
@yunake: The current behavior seems to only try evince
for PDF files, so installing Evince alone is not sufficient as a workaround if you plan to open any other (non-PDF) file types. As a temporary workaround, the following was sufficient for me:
ln -s /usr/bin/open $HOME/.local/bin/xdg-open
@phiresky: Personally, I believe the bundled script has value. Rather than removing it, I suggest a fix along the lines of the above-linked pull request. Then perhaps a subsequent iteration with more configurability would also be very welcome. ๐
Well the only reason why evince is hard coded is because it actually opens the find menu on evince (via --find
) and thus scrolls the PDF automatically to the appropriate section. So replacing that needs a syntax to allow that for arbitrary file types and arbitrary operating systems, if it's the same for each file extension then the script is kind of pointless, and since custom adapters exists it also needs to be configurable