diff --git a/utils/self-extracting-executable/decompressor.cpp b/utils/self-extracting-executable/decompressor.cpp index 6614403c0ab..071ecb066cb 100644 --- a/utils/self-extracting-executable/decompressor.cpp +++ b/utils/self-extracting-executable/decompressor.cpp @@ -529,14 +529,22 @@ int main(int/* argc*/, char* argv[]) char decompressed_name[decompressed_name_len + 1]; (void)snprintf(decompressed_name, decompressed_name_len + 1, decompressed_name_fmt, self, decompressed_suffix); +#if defined(OS_DARWIN) + // We can't just rename it on Mac due to security issues, so we copy it... std::error_code ec; - + std::filesystem::copy_file(static_cast(decompressed_name), static_cast(self), ec); + if (ec) + { + std::cerr << ec.message() << std::endl; + return 1; + } +#else if (link(decompressed_name, self)) { perror("link"); return 1; } - +#endif if (chmod(self, static_cast(decompressed_umask))) { perror("chmod");