diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 49a774ba576..f02520787e6 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -61,6 +61,10 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include #endif +#ifdef __APPLE__ +# include "libproc.h" +#endif + #include #include @@ -6913,6 +6917,12 @@ static int get_exepath(char *buf, size_t size, const char *argv0) ssize_t ret = readlink("/proc/self/exe", buf, size-1); if(ret > 0) return 0; +#elif defined(__APPLE__) + size_t ret = proc_pidpath(getpid(), buf, static_cast(size)); + if (ret > 0) { + buf[ret] = 0; + return 0; + } #endif return my_realpath(buf, argv0, 0);