Workaround method for mounting Borg or Restic repos in macOS without FUSE. Specifically aimed for browsing backups to preview files within or restoring a portion of a backup rather than everything.
Update: as of restic 0.17.0, restic finally supports using FUSE-T as an alternative to osxFUSE/macFUSE,see restic changelog. Leaving this repo as is for those that wish to stick with Borg or not use FUSE-T as it is closed source.
Restic and BorgBackup are probably the most stable and well-developed FOSS backup tools for macOS that have a mounting capability for backup browsing. However, both use macFUSE for mounting on macOS, which requires reducing security due to its system kext requirement.
Until Borg and restic implement an kextless alternative like FUSE-T, or implement an alternative method of mounting like using webDAV (example: Cryptomator), Kopia is a great alternative if you are willing to use something that is still in active development (but by most accounts, completely fine, and being commercially supported/deployed), as it supports WebDAV mounting of snapshots.
For those that do still want to use Restic or Borg and do not want to change the required security settings needed to make macFUSE work on apple silicon (M1, etc.), the easiest ways to do so are using things like ResticBrowser and Borg-Repo-Explorer, which are viable ways to browse backups with minimal effort, but are not a full solution to be able to search quickly and preview files yet.
This hacky workaround uses a lightweight Alpine Linux VM to handle to handle mounting backups, and Cyberduck to browse them. Transferring files out of backups is done either with SSHFS/SFTP using Cyberduck, or via a VM-Host shared directory.
refer to new-lima-templates folder for correct .yaml's
This method uses Lima with Apple's Virtualization.framework (VZ), Alpine Linux and VirtioFS along with Cyberduck. Offers the best combination of convenience, file copying performance and low resource usage I could come up with.
- Download one of the
alpine-virtiofs-*.yaml
config file from this repository to a directory of your choice.- This is a configuration file will install a minimal Alpine Linux instance with rsync.
- BorgBackup users should download
alpine-virtiofs-borg.yaml
. Restic users should downloadalpine-virtiofs-restic.yaml
.
- Open up the .yaml file in a text editor. We need to configure a shared directory location between VM and the host to be able extract files from your backups to.
- go to the "mounts" section in the file
- change /path/to/location/on/host to the filepath to the directory where you want files to show up in macOS. This filepath has to be the full filepath. For example, for a directory called 'testdir' on the Desktop in macOS, you would put
/Users/yourmacusername/Desktop/testdir
. Make sure to create this directory before moving on. - change /path/to/location/on/vm to the filepath where you want the directory to show up in the Linux VM. This is where you will copy files from your backups to in the VM. A convenient location is /mnt. For example,
/mnt/HostMount
. - if you perhaps store backups locally, you can mount them here to a folder by creating a new
- location
entry. Just follow the same "location, mountPoint, writeable" pattern you see in the template already.
- Scroll to the
provision
section, and under thescript
portion, undersudo cp -r /home/*/.ssh /root
(Do not change), make any additional folders you want by adding in lines ofsudo mkdir /path/to/directory/in/vm
.
- Add a dedicated folder to temporarily mount backups to, for example
sudo mkdir /mnt/BackupMountPoint
. - If you use a NAS on your network to store your backups using an SMB share, or a remote location that you mount with rclone, you can make a folder in which to mount them in, like
sudo mkdir /mnt/NASMountPoint
.
- Feel free to add/delete packages as you wish from the
provision
>script
section of the yaml file you download or just leave it as is.- For example, you may want to add rclone if you store and mount backups from a remote location.
- If you are mounting network storage of some kind, you may need to add some packages. For example, included already are the tools necessary for mounting SMB/CIFS shares, but you may need to mount an NFS share, so you would need to add a line to install the
nfs-utils
package usingsudo apk add nfs-utils
.
- under the
ssh
section, alocalPort
has been defined that will allow us to access the VM via Cyberduck. I chose port54551
because it is usually a free port, but you can change it to some other number if you wish. - Save and close.
- Open Terminal and download/install Lima via homebrew using
brew install lima
. Lima is a lightweight virtualizer for macOS that lets you easily spin up linux VMs. We are going to be spinning up a really small Alpine Linux VM to achieve what we want/ cd
to the the directory you downloaded the .yaml file to and then runlimactl create --cpus=2 --memory=2 --disk=5 --name=name-here /path/to/alpine-*.yaml
. Hit enter to select Proceed with current configuration, and Lima will create an Alpine Linux VM based on the .yaml file.
- Tweak the number of cpu cores, memory and disk size how you see fit. See Lima's documentation for notes.
- Set
--name
to what you want the VM instance to be called, likealp
/path/to/alpine-*.yaml
is the filepath to where you downloaded whichever .yaml file you chose
- Download and install Cyberduck. Cyberduck is a server/storage browser that is very similar to Finder. It will allow you to connect to the Alpine Linux VM and browse/transfer files from it to your Mac.
- run
limactl start name-here
where name-here is whatever you named the instance. This will launch your instance.- The initial setup may take a bit as your VM instance downloads all the packages and sets everything up. Once it's done, you can verify it's running by using
limactl list
.
- The initial setup may take a bit as your VM instance downloads all the packages and sets everything up. Once it's done, you can verify it's running by using
- Once your newly spun up VM is running, open Cyberduck. In the menu bar, go to Bookmark > New Bookmark. In the window that pops up:
- Click on the dropdown that currently says FTP, and change it to SFTP (SSH File Transfer Protocol)
- Change the Nickname field to whatever you wish to call the bookmark.
- In the Server field, type
127.0.0.1
. In the Port field type the ssh port number you assigned in the .yaml file from Part 1, Step 1 (the default is port54551
. - In the User field, type
root
- Click the SSH Private Key dropdown, and click Choose. A finder window should open, and by default it should show your Mac's User folder. Turn on "Show Hidden Files" by hitting
Cmd + Shift + .
. A few new folders should be showing now. Go to .lima > _config > and click theuser
file (NOT the user.pub file) and then hit Choose. The field should now say~/.lima/_config/user
. - Close the window, and there should be a bookmark in the main Cyberduck window now.
- Either continue to Part 2 and configure an auto-start script or skip to the Manually Mounting section.
This method uses Lima, QEMU, Alpine Linux, and VirtFS-9P.
- Download one of the
alpine-virt9p-*.yaml
config file from this repository to a directory of your choice.- BorgBackup users should download
alpine-virt9p-borg.yaml
. Restic users should downloadalpine-virt9p-restic.yaml
.
- BorgBackup users should download
- Follow the rest of the steps in the Method for macOS13 and Above.
If you are having issues, use one of the Alpine GUI methods in AlpineDeprecratedMethods or Ubuntu GUI methods in UbuntuDeprecatedMethods.
By now, you have a really lightweight VM that has all the tools you need to mount backups. The next step is to make everything start up easily.
Below is an example of a small "one-click" startup button made using the built-in macOS application Automator. This script starts the VM, opens Cyberduck and starts an SSH session via the bookmark you made, and (optionally), runs a mount script inside the VM that will mount any network locations where you may store your backups, and mounts your Borg/Restic Backups to a directory in the VM (such as the one you created in Part 1, Step 1). This assumes you only have one bookmark in Cyberduck.
- Open Automator, and create a new Application. Add a "Run Applescript" to the flow. Below is an example of what you can have in the startup script:
- If you are not mounting a network location, or do not want to use mounting script:
- delete the
do script "limactl copy ....
,do script "chmod ...
, anddo script "./mountingscript.sh
lines. - change all instances of
name-here
to whatever you named your VM instance
- delete the
- If you are:
- change
/path/to/mounting/mountingscript.sh
to the directory of where your mounting script is on macOS - change all instances of
name-here
to whatever you named your VM instance - change
mountingscript.sh
to whatever you named your mount script if you have one
- change
- Save it to your Applications folder and name it whatever you want.
- Running this script will open a terminal window and run the commands in the terminal window automatically. You may be prompted for credentials within the terminal window depending on if you choose to use mounting script in conjunction. It will also open Cyberduck and start a
This is a bash script you can make that automounts any network storages and your borg/restic repo. You can create it using a text editor. Name it something like mountingscript.sh
. Below is an example that mounts a NAS with an SMB share and a borg backup stored on that SMB share:
You can change the paths to whatever you like, and the mountpoints to the folders you may have created in Part 1, Step 1.
This script will be called copied over by the automator script to the VM if you have configured it to do so, and executed automatically. you will be prompted for your credentials to mount your network share and your repository. Configure this script however you need to.
For restic, see their docs for restic mount
here.
For Borg, see their docs for borg mount
here.
If you choose not to make a mount script, you can just mount via command line as you normally would. While the VM is running, in a terminal window, run limactl shell name-here
. This will open terminal instance inside the VM where you can run commands. See the docs linked above. Make sure to run all commands as sudo, or you may get permissions errors. To exit the ssh instance, just run exit
.
If you configured an auto-start script/mounting script earlier then it will automatically open the VM, open Cyberduck and start a connection using the bookmark you made earlier, and mount your Borg/restic backup.
If you chose to manually mount, make sure you have mounted your Borg/Restic backups within the VM before opening Cyberduck and starting a connection to the VM by double clicking the bookmark you made earlier.
Either case may open a window in Cyberduck saying Changed fingerprint and Allow or Deny. Tick Always if you do not want to see this window when you connect, and then hit Allow. By default, Cyberduck starts the connect in the user you are connecting as's home folder. Since we are connecting as root
, it drops us in /root
. You can now use Cyberduck similarly to how you would Finder. Browse to whereever you mounted your backup earlier, and browse it like you normally would.
To preview files, you can use Cyberduck's Quick Look feature. This works especially well with files of smaller sizes. Just browse to the file in the backup/repo you want to preview, right click on them and hit Quick Look. This will simply open them within macOS in a program that can open them. For example, if you Quick Look a pdf file, it will just open in Preview like normal. Quick Look may take a few seconds longer with larger files like movies in my testing, so it may be more convenient to just copy them over quickly to view them.
Simply drag them from Cyberduck to whereever you want to copy the files to on macOS. This will transfer the files out of the VM via SFTP/SSHFS. This method is fast enough for most cases.
In a terminal window, run limactl shell name-here
, which will start a terminal instance to your VM (if you have configured an auto-start script similar to above, then there will already be one open). In Cyberduck, right click on the file/directory you wish to copy to the host and hit Info (or just use Cmd + I). In the window that pops up, under General, copy the filepath next to Where.
Go back to the terminal window and run an rsync command similar to sudo rsync -r --info=progress2 /pasted/file/path/from/Cyberduck/ /path/to/shared/VM/host/directory
/pasted/file/path/from/Cyberduck/
is where you can just paste the filepath you copied from Cyberduck (path to the files within your mounted backup)/path/to/shared/VM/host/directory
is the path to the shared VM-Host directory within the VM that you configured in the .yaml file in Part 1, Step 1.
This command uses rsync to copy the desired file/directory to the VirtioFS/Virt-9P shared VM-Host directory, and show progress. It will be much faster than using SSHFS/SFTP. The file/directory will appear on macOS where you configured them to in the .yaml file from Part 1, Step 1.
-
see
restic restore
documentation here or borg's restore options documentation here. and copy to the shared directory. -
But honestly, if you plan on extracting most, if not all files within a backup, it is much easier to just do this natively on macOS using Vorta for Borg/borg extract or restic restore rather than within the VM.
When done, disconnect your Cyberduck browser by either just closing the program or by going to the menu bar > Go > Disconnect. To stop the VM, in a terminal window, run limactl stop name-here
.
This was the most straightforward way I could come up with to achieve what I wanted with on macOS. This was inspired by this post. Things that could be done to improve this include setting up a BASH script to do much of the setup autimatically, or some of the alternatives/tweaks listed below.
- Macpine, OrbStack, and Tart may be viable alternatives to Lima incase it is giving you a headache. Further, if you would be okay using Ubuntu specificially instead of Alpine, Multipass is an extremely easy way to get Ubuntu VMs running. It does not support VirtioFS yet, but I think they are actively working on implementing this and support Apple's Virtualization.framework instead of QEMU. See UbuntuDeprecatedMethods.
- Docker using bind mounts(?) may be another way to achieve this. See restic. Could be adapted for Borg by someone motivated.