diff --git a/src/mac/getself.m b/src/mac/getself.m
new file mode 100644
index 0000000000000000000000000000000000000000..16ac964489fecd9bd6c29a329f08fca7082fce63
--- /dev/null
+++ b/src/mac/getself.m
@@ -0,0 +1,18 @@
+#import <Cocoa/Cocoa.h>
+
+const char *get_self_executable(int argc, char **argv)
+{
+	static char *cstr = 0;
+
+	if(!cstr)
+	{
+		NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
+		resourcePath = [NSString stringWithFormat:@"%@/", resourcePath];
+		const char *utf8 = [resourcePath UTF8String];
+
+		cstr = malloc(strlen(utf8) + 1);
+		strcpy(cstr, utf8);
+	}
+
+	return cstr;
+}