@@ -23,7 +23,7 @@ use std::{error::Error, process::Output};
2323use tokio:: io:: AsyncWriteExt ;
2424use zip:: read:: ZipArchive ;
2525
26- #[ cfg( unix ) ]
26+ #[ cfg( target_os = "linux" ) ]
2727use nix:: unistd:: { Uid , Gid } ;
2828
2929pub fn print_header ( ) {
@@ -590,19 +590,28 @@ pub fn query_balance(project_root_path: &Path, address: &str) -> u64 {
590590 . sum ( )
591591}
592592
593- /// Get current user's UID and GID for Docker containers (Unix only)
594- /// Returns (UID, GID) or default (1000, 1000) on non-Unix systems
593+ /// Get current user's UID and GID for Docker containers
594+ /// - macOS: Returns 0:0 (root) for compatibility
595+ /// - Linux: Returns actual user UID/GID
596+ /// - Windows: Returns default 1000:1000
595597pub fn get_user_ids ( ) -> ( String , String ) {
596- #[ cfg( unix) ]
598+ #[ cfg( target_os = "macos" ) ]
599+ {
600+ // Use root permissions on macOS
601+ ( "0" . to_string ( ) , "0" . to_string ( ) )
602+ }
603+
604+ #[ cfg( target_os = "linux" ) ]
597605 {
606+ // Use actual user UID/GID on Linux
598607 let uid = Uid :: current ( ) . as_raw ( ) ;
599608 let gid = Gid :: current ( ) . as_raw ( ) ;
600609 ( uid. to_string ( ) , gid. to_string ( ) )
601610 }
602611
603- #[ cfg( not( unix ) ) ]
612+ #[ cfg( not( any ( target_os = "macos" , target_os = "linux" ) ) ) ]
604613 {
605- // Default UID/GID for non-Unix systems (Windows)
614+ // Default UID/GID for other systems (Windows, etc. )
606615 ( "1000" . to_string ( ) , "1000" . to_string ( ) )
607616 }
608617}
0 commit comments