From 4ca56524b57c28c6ce88d6093ef29832c04b6075 Mon Sep 17 00:00:00 2001 From: blacktop Date: Thu, 9 Jan 2025 11:03:19 -0700 Subject: [PATCH] chore: lookup abs path for apfs-fuse in $PATH #570 --- internal/utils/macos.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/utils/macos.go b/internal/utils/macos.go index 8adeceb1e..73199583f 100644 --- a/internal/utils/macos.go +++ b/internal/utils/macos.go @@ -20,6 +20,7 @@ import ( "github.com/blacktop/ipsw/internal/utils/lsof" "github.com/blacktop/ipsw/pkg/aea" semver "github.com/hashicorp/go-version" + "golang.org/x/sys/execabs" ) // Cp copies a file from src to dest @@ -474,7 +475,11 @@ func Mount(image, mountPoint string) error { return fmt.Errorf("%v: %s", err, out) } } else { - out, err := exec.Command("apfs-fuse", image, mountPoint).CombinedOutput() + apfsFusePath, err := execabs.LookPath("apfs-fuse") + if err != nil { + return fmt.Errorf("failed to find apfs-fuse in $PATH: %v", err) + } + out, err := exec.Command(apfsFusePath, image, mountPoint).CombinedOutput() if err != nil { return fmt.Errorf("failed to mount '%s' via apfs-fuse: %v: cmd output - '%s'", image, err, out) }