restic-browser
restic-browser copied to clipboard
Issue with $PATH on OSX
Thanks for this tool. I'm having an issue that I don't know how to solve (sorry if this is a basic question).
I have both restic and rclone (for the repository) in my $PATH
, but when I run restic-browser it does not detect restic and asks me to manually set the path to the executable. Then, when I do that, and try to browse my rclone repository, I get an error saying rclone is not in the $PATH
.
How do I fix this? I'm running MacOS Ventura btw and using zsh ($PATH
is defined in the ~/.zshrc
file).
Same here with the same config.
Paths to restic and rclone are in the .zshrc
file as
export PATH="$PATH:/usr/local/bin"
export PATH="$PATH:/opt/homebrew/bin"
export PATH="$PATH:/opt/homebrew/sbin"
but they are not detected, even after source .zshrc
or a reboot
(zsh is now the standard shell in macOS; rclone got installed via homebrew)
I had the same issue, and I found a workaround which suits my needs.
Opening Restic-Browser.app from CLI it works perfectly and uses RESTIC_REPOSITORY
and RESTIC_PASSWORD
from env.
Simply use the good old open
command:
e.g.
open /PATH/TO/Restic-Browser.app
There was also a PR: which was not merged due This has some side-effects. Closed until resolved.
https://github.com/emuell/restic-browser/pull/27
I had the same issue, and I found a workaround which suits my needs.
Opening Restic-Browser.app from CLI it works perfectly and uses RESTIC_REPOSITORY and RESTIC_PASSWORD from env.
Simply use the good old open command:
e.g.
open /PATH/TO/Restic-Browser.app
Can confirm that this works for me. Thanks!
How do I fix this? I'm running MacOS Ventura btw and using zsh ($PATH is defined in the ~/.zshrc file).
It's unfortunately quite a pain to configure PATH for apps started with Finder on OSX.
See e.g. https://serverfault.com/questions/16355/how-do-i-set-the-global-path-environment-variable-on-os-x#146142
All those workarounds seem to no longer work in newer versions of OSX.
The easiest way around this may be installing the restic binary to some path which already is in PATH by default, in you don't want to start in from the terminal app.
Thanks for the clarification. Would a solution in which users specify the path to restic
and/or rclone
once and have it saved in Restic Browser's config work (and hopefully be easy to implement)?
I agree, this could be a solution. Something like
- Check $PATH for
restic
binary and use it if found - If not found in $PATH open a dialog and let user set location
- this is partly already implemented. just safe the value somewhere suitable
- Throw an error when no binary is given or not working
Another solution could be, to bundle restic together with Restic-Browser. Although this would be probably a completely different approach.
Thought about bundling restic too, but this and saving the path to the located restic binary also doesn't fix darthlite's second problem: that rclone could also not be found.
Why not just save both the path to restic and rclone (if used)?
@emuell I checked your stackoverflow link. The solution which points to, put a file in /etc/paths.d/
actually looks like a viable solution.
My suggestion, leave this part to the user: simply check with Restic-Browser if it can locate third party dependencies like restic and clone and whatnot. If Restic-Browser is not able to detect those, give the user a link to the README.md with an installation howto. I would be willing in extending the README.md in that direction.
This way, the code changes on your end are minimal and you provide the user with the necessary information.
@darthlite: depending on your setup, I guess you are using homebrew to install restic and rclone, simple put a textfile in /etc/paths.d/
called homebrew
and put in the homebrew bin-path. On newer Macs it is usually something like /opt/homebrew/bin/
in the past it was usually /usr/local/bin
if I remember correctly. Best to check this with which restic
and/or which rclone
Restart your Mac since the files in this directory are as it seems only read at system start and you should be good to go.
@emuell I checked your stackoverflow link. The solution which points to, put a file in
/etc/paths.d/
actually looks like a viable solution.My suggestion, leave this part to the user: simply check with Restic-Browser if it can locate third party dependencies like restic and clone and whatnot. If Restic-Browser is not able to detect those, give the user a link to the README.md with an installation howto. I would be willing in extending the README.md in that direction.
This way, the code changes on your end are minimal and you provide the user with the necessary information.
@darthlite: depending on your setup, I guess you are using homebrew to install restic and rclone, simple put a textfile in
/etc/paths.d/
calledhomebrew
and put in the homebrew bin-path. On newer Macs it is usually something like/opt/homebrew/bin/
in the past it was usually/usr/local/bin
if I remember correctly. Best to check this withwhich restic
and/orwhich rclone
Restart your Mac since the files in this directory are as it seems only read at system start and you should be good to go.
This method does not work. It adds new path to user PATH but does not make difference for restic-browser ability to find needed binaries.
what works for me is to make sure that required path is in my shell PATH and then instead of starting restic-browser from Finder start it from Terminal:
/Applications/Restic-Browser.app/Contents/MacOS/restic-browser
both restic and rclone path should be configurable and remembered by rclone-browser. This would be ideal solution.
both restic and rclone path should be configurable and remembered by rclone-browser.
Unfortunately, as mentioned above, this would only work for the restic binary. There's no way to pass a PATH to the restic binary so that it can find rclone.
Depending on which version of OSX you can also try following solution from Homebrew's FAQ:
https://docs.brew.sh/FAQ#my-mac-apps-dont-find-homebrew-utilities
And here's a more detailed explanation on how to change the PATH with launchctl
:
https://sparanoid.blog/749646
both restic and rclone path should be configurable and remembered by rclone-browser.
Unfortunately, as mentioned above, this would only work for the restic binary. There's no way to pass a PATH to the restic binary so that it can find rclone.
are you sure?
I think restic allows to specify explicitly rclone binary location
-o rclone.program=/path/rclone
-o rclone.program=/path/rclone
Thanks. Wasn't aware of this option.
Then this indeed would work, but will require a new "preferences" dialog in Restic Browser to set up those paths.
Another workaround: you can use this tool https://github.com/sveinbjornt/Platypus to create an app that runs this script
Create a restic-with-path.sh
or whatever and change path to where your restic is
#!/usr/bin/env sh
export PATH="$PATH:/opt/local/bin:/usr/local/bin"
open -a 'Restic-Browser.app'
and launch this app instead of the original
The next version of Restic Browser will look for for restic in the following paths on MacOS, if it cannot be found in PATH:
/usr/local/bin:/opt/local/bin:/opt/homebrew/bin:~/bin
.
This should cover most of the default locations where restic is installed, so hopefully all those PATH hacks won't be necessary on OSX anymore.
This feature hasn't been released yet, but most recent builds that include it can be downloaded here: https://github.com/emuell/restic-browser/actions
The next version of Restic Browser will look for for restic in the following paths on MacOS, if it cannot be found in PATH:
/usr/local/bin:/opt/local/bin:/opt/homebrew/bin:~/bin
.This should cover most of the default locations where restic is installed, so hopefully all those PATH hacks won't be necessary on OSX anymore.
This feature hasn't been released yet, but most recent builds that include it can be downloaded here: https://github.com/emuell/restic-browser/actions
My copy of Rclone is at /usr/local/bin but it's still not finding it. I'm assuming since this issue is closed, that's been fixed? How can you set the path so that Restic-Browser sees it? I'm running v0.3.0.
Yes, it should have been found automatically, when it's located at this path. Which filename does the restic binary have? It must be just "restic", not "restic-vsomething". Also does location the binary manually work?