diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 045bc2dbf3f45ea28ed7a32c70430f384ef12b3e..41dc6f41b70de30ba6a434103f18d41dc1270830 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -394,9 +394,16 @@ std::string LLAppViewerMacOSX::generateSerialNumber()
 
 	// JC: Sample code from http://developer.apple.com/technotes/tn/tn1103.html
 	CFStringRef serialNumber = NULL;
-    io_service_t    platformExpert = IOServiceGetMatchingService(kIOMainPortDefault,
-																 IOServiceMatching("IOPlatformExpertDevice"));
-	if (platformExpert)
+    io_service_t platformExpert = NULL;
+    if (__builtin_available(macOS 12.0, *)) {
+        platformExpert = IOServiceGetMatchingService(kIOMainPortDefault,
+                                                                     IOServiceMatching("IOPlatformExpertDevice"));
+    } else {
+        platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
+                                                                     IOServiceMatching("IOPlatformExpertDevice"));
+    }
+    
+    if (platformExpert)
     {
 		serialNumber = (CFStringRef) IORegistryEntryCreateCFProperty(platformExpert,
 																	 CFSTR(kIOPlatformSerialNumberKey),
diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp
index eebe8ae80c9efd7a846d78b3a1894d69e0bbcb53..5fa9cc5602c312f3fafcf97a5ff3ceeeb27b5ab5 100644
--- a/indra/newview/llmachineid.cpp
+++ b/indra/newview/llmachineid.cpp
@@ -350,8 +350,15 @@ bool LLWMIMethods::getGenericSerialNumber(const BSTR &select, const LPCWSTR &var
 bool getSerialNumber(unsigned char *unique_id, size_t len)
 {
     CFStringRef serial_cf_str = NULL;
-    io_service_t platformExpert = IOServiceGetMatchingService(kIOMainPortDefault,
-                                                                 IOServiceMatching("IOPlatformExpertDevice"));
+    io_service_t platformExpert = NULL;
+    if (__builtin_available(macOS 12.0, *)) {
+        platformExpert = IOServiceGetMatchingService(kIOMainPortDefault,
+                                                                  IOServiceMatching("IOPlatformExpertDevice"));
+    } else {
+        platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
+                                                                  IOServiceMatching("IOPlatformExpertDevice"));
+    }
+    
     if (platformExpert)
     {
         serial_cf_str = (CFStringRef) IORegistryEntryCreateCFProperty(platformExpert,