awslabs / mountpoint-s3

A simple, high-throughput file client for mounting an Amazon S3 bucket as a local file system.
Apache License 2.0
4.24k stars 144 forks source link

macOS support #444

Open AndrewFarley opened 10 months ago

AndrewFarley commented 10 months ago

Tell us more about this new feature.

Tell us more about this new feature.

Support for OS-X with S3 being presented presented as a mounted drive in the Finder and available in the Terminal as you would use similarly in Linux

dannycjones commented 10 months ago

Thank you for the feature request, Andrew! I have no information to share about official support for macOS.

Anecdotally, I've been able to run Mountpoint during development and interact with files both from a terminal as well as in Finder. It does require there to be FUSE support from the macOS kernel, which you may be able to provide using something like macFUSE. However, this is not something we officially support or recommend at this time.

mojodna commented 10 months ago

I'm unable to install macFUSE due to the kernel extension requirement. However, I was able to build mountpoint-s3 against fuse-t, a kext-less FUSE implementation, after applying the following patch. Unfortunately, while it runs (and debug logging indicates that mounting was successful) and even triggers the fuse-t's NFS mount, it doesn't show up in the list of volumes (df -h) and the target path appears empty. (The fuse-t version of sshfs does work, fwiw.)

❯ ps ax | grep nfs
24545   ??  Ss     0:00.02 /usr/local/bin/go-nfsv4 -r --noatime=true /tmp/s3
diff --git i/vendor/fuser/build.rs w/vendor/fuser/build.rs
index 8a1dc97..8f39a57 100644
--- i/vendor/fuser/build.rs
+++ w/vendor/fuser/build.rs
@@ -13,11 +13,18 @@ fn main() {
                 .is_ok()
             {
                 println!("cargo:rustc-cfg=feature=\"libfuse2\"");
-            } else {
-                pkg_config::Config::new()
+            } else if pkg_config::Config::new()
                     .atleast_version("2.6.0")
                     .probe("osxfuse") // for osxfuse 3.x
                     .map_err(|e| eprintln!("{}", e))
+                    .is_ok()
+            {
+                println!("cargo:rustc-cfg=feature=\"libfuse2\"");
+            } else {
+                pkg_config::Config::new()
+                    .atleast_version("1.0.27")
+                    .probe("fuse-t") // for fuse-t (https://github.com/macos-fuse-t/fuse-t)
+                    .map_err(|e| eprintln!("{}", e))
                     .unwrap();
                 println!("cargo:rustc-cfg=feature=\"libfuse2\"");
             }
macos-fuse-t commented 10 months ago

@mojodna Clone and build libfuse from https://github.com/macos-fuse-t/libfuse. Then build https://github.com/macos-fuse-t/mountpoint-s3.git

cpboyd commented 9 months ago

@macos-fuse-t I think you meant https://github.com/macos-fuse-t/mountpoint-s3 Took a bit for me to find it

mojodna commented 9 months ago

@macos-fuse-t whoa, that's awesome. working like a charm! thanks for writing the patch!

AugustDev commented 8 months ago

@macos-fuse-t @mojodna @cpboyd can you explain in bit more detail how you managed to build mountpoint-s3 on Mac?

WesleyBatista commented 6 months ago

@AugustDev, here are the steps I've followed on a M1:

  1. Install macFUSE - a bit tricky as it requires you to enable Kernel Extensions. Installation windows will instruct you
  2. git clone git@github.com:awslabs/mountpoint-s3.git --recurse-submodules - it got a bit slow cloning mountpoint-s3-crt-sys/crt/s2n-tls submodule...
  3. finally, cd into cloned directory and run cargo run --release
Screenshot 2024-01-01 at 14 15 20
AugustDev commented 1 month ago

Thanks for the comment @WesleyBatista. I'm trying to build on M1 and following your steps I get an error

   Compiling bytes v1.6.0
   Compiling bincode v1.3.3
   Compiling mountpoint-s3-crt v0.7.0 (/Users/ops/Projects/tests/mountpoint-s3/mountpoint-s3-crt)
   Compiling mountpoint-s3-client v0.8.1 (/Users/ops/Projects/tests/mountpoint-s3/mountpoint-s3-client)
   Compiling mountpoint-s3 v1.6.0 (/Users/ops/Projects/tests/mountpoint-s3/mountpoint-s3)
error[E0658]: use of unstable library feature 'result_option_inspect'
    --> mountpoint-s3/src/inode.rs:1592:37
     |
1592 |         self.map.insert(ino, inode).inspect(Self::remove_metrics)
     |                                     ^^^^^^^
     |
     = note: see issue #91345 <https://github.com/rust-lang/rust/issues/91345> for more information

error[E0658]: use of unstable library feature 'result_option_inspect'
    --> mountpoint-s3/src/inode.rs:1596:30
     |
1596 |         self.map.remove(ino).inspect(Self::remove_metrics)
     |                              ^^^^^^^
     |
     = note: see issue #91345 <https://github.com/rust-lang/rust/issues/91345> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `mountpoint-s3` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
passaro commented 1 month ago

@AugustDev, are you building with the latest stable toolchain? On macOS, that's currently:

$ rustup show
[..]
stable-aarch64-apple-darwin (default)
rustc 1.78.0 (9b00956e5 2024-04-29)
falozzo commented 3 weeks ago

Hi, I'm struggling with this error when I try to build mountpoint-s3 with cargo build --release:

 make: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
  thread 'main' panicked at /Users/a406769/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.63/src/fallback.rs:791:9:
  "aws_io_handle_union_(unnamed_at_/Users/a406769/dev/tools/mountpoint-s3/target/release/build/mountpoint-s3-crt-sys-973e00d705cecc49/out/target/include/aws/io/io_h_18_5)" is not a valid Ident
$ rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/a406769/.rustup
stable-x86_64-apple-darwin (default)
rustc 1.78.0 (9b00956e5 2024-04-29)

Any ideas?

Thanks in advance

falozzo commented 3 weeks ago

Hi, I'm struggling with this error when I try to build mountpoint-s3 with cargo build --release:

 make: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
  thread 'main' panicked at /Users/a406769/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.63/src/fallback.rs:791:9:
  "aws_io_handle_union_(unnamed_at_/Users/a406769/dev/tools/mountpoint-s3/target/release/build/mountpoint-s3-crt-sys-973e00d705cecc49/out/target/include/aws/io/io_h_18_5)" is not a valid Ident
$ rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/a406769/.rustup
stable-x86_64-apple-darwin (default)
rustc 1.78.0 (9b00956e5 2024-04-29)

Any ideas?

Thanks in advance

I solved cloning the original repo as @AugustDev previously said. Thanks

@AugustDev, here are the steps I've followed on a M1:

  1. Install macFUSE - a bit tricky as it requires you to enable Kernel Extensions. Installation windows will instruct you
  2. git clone git@github.com:awslabs/mountpoint-s3.git --recurse-submodules - it got a bit slow cloning mountpoint-s3-crt-sys/crt/s2n-tls submodule...
  3. finally, cd into cloned directory and run cargo run --release
Screenshot 2024-01-01 at 14 15 20