diff --git a/libsql-ffi/build.rs b/libsql-ffi/build.rs index 90f6c0150b..193e161ecd 100644 --- a/libsql-ffi/build.rs +++ b/libsql-ffi/build.rs @@ -76,8 +76,12 @@ fn copy_dir_all(src: impl AsRef, dst: impl AsRef) -> io::Result<()> /// propagate into OUT_DIR. If not present, when trying to rewrite a file, a `Permission denied` /// error will occur. fn copy_with_cp(from: impl AsRef, to: impl AsRef) -> io::Result<()> { - match Command::new("cp") - .arg("--no-preserve=mode,ownership") + let mut command = Command::new("cp"); + // --no-preserve is enabled by default on macos + // preserve must be explicitly enabled with the -p flag + #[cfg(not(target_os = "macos"))] + let command = command.arg("--no-preserve=mode,ownership"); + match command .arg("-R") .arg(from.as_ref().to_str().unwrap()) .arg(to.as_ref().to_str().unwrap())