Index: lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm =================================================================== --- lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm +++ lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm @@ -377,6 +377,16 @@ return g_developer_directory; } +/// Returns the best fitting bash-like shell for running utility shell commands +/// or an empty path if none was found. +static std::string GetShellPath() { + for (std::string path : {"/bin/zsh", "/bin/bash", "/bin/sh"}) { + if (FileSystem::Instance().Exists(path)) + return path; + } + return ""; +} + static std::string GetXcodeSDK(XcodeSDK sdk) { XcodeSDK::Info info = sdk.Parse(); std::string sdk_name = XcodeSDK::GetCanonicalName(info); @@ -392,8 +402,8 @@ int signo = 0; std::string output_str; lldb_private::Status error = - Host::RunShellCommand(xcrun_cmd, FileSpec(), &status, &signo, - &output_str, std::chrono::seconds(15)); + Host::RunShellCommand(GetShellPath(), xcrun_cmd, FileSpec(), &status, + &signo, &output_str, std::chrono::seconds(15)); // Check that xcrun return something useful. if (status != 0 || output_str.empty())