def bootstrap_setting(self): Utilities.cls() Utilities.header(["Set Bootstrap method"]) print( """Sets OpenCore's bootstrap method, currently the patcher supports the following options. Valid options: 1. System/Library/CoreServices/boot.efi (default) 2. EFI/BOOT/BOOTx64.efi 3. Exit Note: S*/L*/C*/boot.efi method is only installed to the EFI partition only and not to macOS itself. Recommended to set to BOOTx64.efi in situations where your Mac cannot see the EFI Boot entry in the boot picker. """) change_menu = input("Set Bootstrap method: ") if change_menu == "1": self.constants.boot_efi = False elif change_menu == "2": self.constants.boot_efi = True else: print("Invalid option")
def change_sip(self): Utilities.cls() Utilities.header(["Set SIP and SecureBootModel"]) print( """SIP and SecureBootModel are used to ensure proper OTA functionality, however to patch the root volume both of these must be disabled. Only disable is absolutely necessary. SIP value = 0xFEF Valid options: 1. Enable Both 2. Disable SIP only 3. Disable SecureBootModel Only 4. Disable Both """) change_menu = input("Set SIP and SecureBootModel(ie. 1): ") if change_menu == "1": self.constants.sip_status = True self.constants.secure_status = True elif change_menu == "2": self.constants.sip_status = False self.constants.secure_status = True elif change_menu == "3": self.constants.sip_status = True self.constants.secure_status = False elif change_menu == "4": self.constants.sip_status = False self.constants.secure_status = False else: print("Invalid option")
def custom_cpu(self): Utilities.cls() Utilities.header(["Set custom CPU Model Name"]) print("""Change reported CPU Model name in About This Mac Custom names will report as follows: 1: Original Name: 2.5 Ghz Dual-Core Intel Core i5 2. CPU name: Intel(R) Core(TM) i5-3210M CPU @ 2.50Ghz 3. Custom Name: 2.5Ghz Cotton Candy (example) """) if self.constants.custom_cpu_model_value == "": if self.constants.custom_cpu_model == 0: print("Currently using original name") else: print("Currently using CPU name") else: print( f"Custom CPU name currently: {self.constants.custom_cpu_model_value}" ) change_menu = input("Set custom CPU Name(1,2,3): ") if change_menu == "1": self.constants.custom_cpu_model = 2 self.constants.custom_cpu_model_value = "" elif change_menu == "2": self.constants.custom_cpu_model = 0 self.constants.custom_cpu_model_value = "" elif change_menu == "3": self.constants.custom_cpu_model = 1 self.constants.custom_cpu_model_value = input( "Enter new CPU Name: ") else: print("Invalid option")
def accel_setting(self): Utilities.cls() Utilities.header(["Enable Beta Acceleration Patches"]) print("""Enables OCLP's experimental GPU Acceleration Patches Note these are still in beta and we highly recommend users not run them daily or expect stable performance. Currently the following are supported: - Nvidia: Tesla and Fermi (8000-500) - AMD/ATI: TeraScale 1 (2000-4000) - Intel: Ironlake and Sandy Bridge For relaibaility, please consider running macOS Catalina or older via Dosdude1's patchers Note: These patches may break Big Sur booting, please have any important data backed up in case of emergencies """) change_menu = input("Enable Beta Acceleration Patches(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.legacy_acceleration_patch = True elif change_menu in {"n", "N", "no", "No"}: self.constants.legacy_acceleration_patch = False else: print("Invalid option")
def set_smbios(self): Utilities.cls() Utilities.header(["Override SMBIOS Spoof"]) print("""Change model OpenCore spoofs Mac too Valid options: 1. Default set by OpenCore (Default) 2. User Override 3. Disable all spoofing (unsupported configuration) """) change_menu = input("Set SMBIOS status: ") if change_menu == "1": print("Setting SMBIOS spoof to default mode") self.constants.override_smbios = "Default" elif change_menu == "2": custom_smbios = input("Set new SMBIOS mode: ") try: test = self.constants.board_id[custom_smbios] self.constants.override_smbios = custom_smbios except KeyError: print("Unsupported SMBIOS, defaulting to Default setting") self.constants.override_smbios = "Default" elif change_menu == "3": print("Disabling SMBIOS spoof") self.constants.override_smbios = self.model else: print("Returning to main menu")
def change_sip(self): Utilities.cls() Utilities.header(["Set SIP and SecureBootModel"]) print( """SIP and SecureBootModel are used to ensure proper OTA functionality, however to patch the root volume both of these must be disabled. Only disable is absolutely necessary. SIP value = 0xFEF Note: for minor changes, SIP can be adjusted in recovery like normal. Additionally, when disabling SIP via the patcher amfi_get_out_of_my_way=1 will be added to boot-args. Valid options: 1. Enable Both 2. Disable SIP only 3. Disable SecureBootModel Only 4. Disable Both """) change_menu = input("Set SIP and SecureBootModel(ie. 1): ") if change_menu == "1": self.constants.sip_status = True self.constants.secure_status = True elif change_menu == "2": self.constants.sip_status = False self.constants.secure_status = True elif change_menu == "3": self.constants.sip_status = True self.constants.secure_status = False elif change_menu == "4": self.constants.sip_status = False self.constants.secure_status = False else: print("Invalid option")
def change_metal(self): Utilities.cls() Utilities.header(["Assume Metal GPU Always in iMac"]) print("""This is for iMacs that have upgraded Metal GPUs, otherwise Patcher assumes based on stock configuration (ie. iMac10,x-12,x) Valid Options: 1. None(stock GPU) 2. Nvidia GPU 3. AMD GPU Note: Patcher will detect whether hardware has been upgraded regardless, this option is for those patching on a different machine or OCLP cannot detect. """) change_menu = input("Set GPU Patch type(ie. 1): ") if change_menu == "1": self.constants.metal_build = False self.constants.imac_vendor = "None" elif change_menu == "2": self.constants.metal_build = True self.constants.imac_vendor = "Nvidia" elif change_menu == "3": self.constants.metal_build = True self.constants.imac_vendor = "AMD" else: print("Invalid option")
def start_unpatch(self): if self.constants.custom_model is not None: print("Unpatching must be done on target machine!") elif self.constants.detected_os < self.constants.big_sur: print(f"Cannot run on this OS, requires macOS 11!") else: self.check_status() Utilities.cls() if (self.sip_patch_status is False) and (self.smb_status is False): print("- Detected SIP and SecureBootModel are disabled, continuing") if self.constants.gui_mode is False: input("\nPress [ENTER] to continue") self.find_mount_root_vol(False) self.unmount_drive() print("- Unpatching complete") print("\nPlease reboot the machine for patches to take effect") if self.sip_patch_status is True: print("SIP set incorrectly, cannot unpatch on this machine!") print("Please disable SIP and SecureBootModel in Patcher Settings") self.csr_decode(self.sip_status, True) print("") if self.smb_status is True: print("SecureBootModel set incorrectly, unable to unpatch!") print("Please disable SecureBootModel in Patcher Settings") print("") if self.fv_status is True: print("FileVault enabled, unable to unpatch!") print("Please disable FileVault in System Preferences") print("") if self.constants.gui_mode is False: input("Press [Enter] to go exit.")
def change_kext(self): Utilities.cls() Utilities.header(["Set Kext DEBUG mode"]) change_menu = input("Enable Kext DEBUG mode(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.kext_debug = True elif change_menu in {"n", "N", "no", "No"}: self.constants.kext_debug = False else: print("Invalid option")
def change_verbose(self): Utilities.cls() Utilities.header(["Set Verbose mode"]) change_menu = input("Enable Verbose mode(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.verbose_debug = True elif change_menu in {"n", "N", "no", "No"}: self.constants.verbose_debug = False else: print("Invalid option")
def change_oc(self): Utilities.cls() Utilities.header(["Set OpenCore DEBUG mode"]) change_menu = input("Enable OpenCore DEBUG mode(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.opencore_debug = True self.constants.opencore_build = "DEBUG" elif change_menu in {"n", "N", "no", "No"}: self.constants.opencore_debug = False self.constants.opencore_build = "RELEASE" else: print("Invalid option")
def download_more_ram_dot_com(self): Utilities.cls() Utilities.header(["Download more RAM"]) print("""Downloads more RAM to your Mac! Currently only offers 1.5TB bundles """) change_menu = input("Download more RAM?(y/n): ") if change_menu == "y": self.constants.download_ram = True elif change_menu == "n": self.constants.download_ram = False else: print("Invalid option")
def change_imac_nvidia(self): Utilities.cls() Utilities.header(["Force iMac Nvidia Patches"]) print("""Specifically for iMac10,x-12,x with Metal Nvidia GPU upgrades By default the patcher will try to detect what hardware is running, however this will enforce iMac Nvidia Build Patches. """) change_menu = input("Assume iMac Nvidia patches(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.imac_nvidia_build = True elif change_menu in {"n", "N", "no", "No"}: self.constants.imac_nvidia_build = False else: print("Invalid option")
def start_patch(self): # Check SIP # self.check_files() if self.constants.custom_model is not None: print("Root Patching must be done on target machine!") elif self.model in ModelArray.NoRootPatch11 and self.constants.assume_legacy is False: print("Root Patching not required for this machine!") elif self.model not in ModelArray.SupportedSMBIOS11 and self.constants.assume_legacy is False: print("Cannot run on this machine, model is unsupported!") elif self.constants.detected_os < self.constants.big_sur: print(f"Cannot run on this OS, requires macOS 11!") else: self.check_status() Utilities.cls() if (self.sip_patch_status is False) and (self.smb_status is False): print( "- Detected SIP and SecureBootModel are disabled, continuing" ) if self.constants.gui_mode is False: input("\nPress [ENTER] to continue") self.check_files() if self.constants.payload_apple_root_path.exists(): self.find_mount_root_vol(True) self.unmount_drive() print("- Patching complete") if self.sucess_status is True: print( "\nPlease reboot the machine for patches to take effect" ) else: print( "\nPlease reboot the machine to avoid potential issues rerunning the patcher" ) if self.sip_patch_status is True: print("SIP set incorrectly, cannot patch on this machine!") print( "Please disable SIP and SecureBootModel in Patcher Settings" ) self.csr_decode(self.sip_status, True) print("") if self.smb_status is True: print("SecureBootModel set incorrectly, unable to patch!") print("Please disable SecureBootModel in Patcher Settings") print("") if self.fv_status is True: print("FileVault enabled, unable to patch!") print("Please disable FileVault in System Preferences") print("") if self.constants.gui_mode is False: input("Press [Enter] to go exit.")
def set_amfi(self): Utilities.cls() Utilities.header(["Disable AMFI"]) print("""Required for Root Patching non-Metal GPUs in macOS Big Sur. Without this, will receive kernel panic once Patcher finishes installing legacy acceleration patches. """) change_menu = input("Disable AMFI(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.disable_amfi = True elif change_menu in {"n", "N", "no", "No"}: self.constants.disable_amfi = False else: print("Invalid option")
def disable_cpufriend(self): Utilities.cls() Utilities.header(["Disable CPU Friend?"]) print("""Only recommended for advanced users Disabling CPUFriend forces macOS into using a different Mac's power profile for CPUs and GPUs, which can harm the hardware """) change_menu = input("Disable CPU Friend?(y/n): ") if change_menu == "y": self.constants.disallow_cpufriend = True elif change_menu == "n": self.constants.disallow_cpufriend = False else: print("Invalid option")
def change_showpicker(self): Utilities.cls() Utilities.header(["Set OpenCore Picker mode"]) print( """By default, OpenCore will show its boot picker each time on boot up, however this can be disabled by default and be shown on command by repeatedly pressing the "Esc" key """) change_menu = input("Show OpenCore Picker by default(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.showpicker = True elif change_menu in {"n", "N", "no", "No"}: self.constants.showpicker = False else: print("Invalid option")
def change_wifi(self): Utilities.cls() Utilities.header(["Assume Upgraded Wifi Always"]) print("""This is for Macs with upgraded wifi cards(ie. BCM94360/2) Note: Patcher will detect whether hardware has been upgraded regardless, this option is for those patching on a different machine or cannot detect. """) change_menu = input("Enable Upgraded Wifi build algorithm?(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.wifi_build = True elif change_menu in {"n", "N", "no", "No"}: self.constants.wifi_build = False else: print("Invalid option")
def force_accel_setting(self): Utilities.cls() Utilities.header(["Assume Legacy GPU"]) print("""Allows any model to force install Legacy Acceleration patches. Only required for Mac Pro and Xserve users. DO NOT RUN IF METAL GPU IS INSTALLED """) change_menu = input("Enable Beta Acceleration Patches(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.assume_legacy = True elif change_menu in {"n", "N", "no", "No"}: self.constants.assume_legacy = False else: print("Invalid option")
def wifi_probe(self): # result = subprocess.run("ioreg -r -c IOPCIDevice -a -d2".split(), stdout=subprocess.PIPE).stdout.strip() devices = self.ioregistry.find(property=( "class-code", binascii.a2b_hex( Utilities.hexswap(hex(WirelessCard.CLASS_CODE)[2:].zfill(8))))) # if not result: # # No devices # print("A") # return # devices = plistlib.loads(result) # devices = [i for i in devices if i["class-code"] == binascii.a2b_hex("00800200")] # if not devices: # # No devices # print("B") # return for device in devices: vendor: Type[WirelessCard] = PCIDevice.from_ioregistry( device, anti_spoof=True).vendor_detect( inherits=WirelessCard) # type: ignore if vendor: self.wifi = vendor.from_ioregistry( device, anti_spoof=True) # type: ignore break
def storage_probe(self): sata_controllers = self.ioregistry.find( entry_class="IOPCIDevice", property=("class-code", binascii.a2b_hex( Utilities.hexswap( hex(SATAController.CLASS_CODE)[2:].zfill(8))))) nvme_controllers = itertools.chain.from_iterable([ # self.ioregistry.find(entry_class="IOPCIDevice", property=("class-code", binascii.a2b_hex(Utilities.hexswap(hex(NVMeController.CLASS_CODE)[2:].zfill(8))))), self.ioregistry.find(entry_class="IOPCIDevice", children={"entry_class": "IONVMeController"}), ]) for device in sata_controllers: self.storage.append(SATAController.from_ioregistry(device)) for device in nvme_controllers: aspm = device.properties.get("pci-aspm-default", 0) if isinstance(aspm, bytes): aspm = int.from_bytes(aspm, byteorder="little") if device.parent.parent.entry_class == "IOPCIDevice": parent_aspm = device.parent.parent.properties.get( "pci-aspm-default", 0) if isinstance(parent_aspm, bytes): parent_aspm = int.from_bytes(parent_aspm, byteorder="little") else: parent_aspm = None controller = NVMeController.from_ioregistry(device) controller.aspm = aspm controller.parent_aspm = parent_aspm if controller.vendor_id != 0x106B: self.storage.append(controller)
def allow_native_models(self): Utilities.cls() Utilities.header(["Allow OpenCore on native Models"]) print("""Allows natively supported Macs to use OpenCore. Recommended for users with 3rd Party NVMe SSDs to achieve improved overall power usage. """) change_menu = input("Allow OpenCore on all Models(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.allow_oc_everywhere = True self.constants.serial_settings = "None" elif change_menu in {"n", "N", "no", "No"}: self.constants.allow_oc_everywhere = False self.constants.serial_settings = "Minimal" else: print("Invalid option")
def download_files(self): if self.constants.detected_os == self.constants.monterey: os_ver = "12-Monterey" elif self.constants.detected_os == self.constants.big_sur: os_ver = "11-Big-Sur" elif self.constants.detected_os == self.constants.catalina: os_ver = "10.15-Catalina" elif self.constants.detected_os == self.constants.mojave: os_ver = "10.14-Mojave" link = f"{self.constants.url_patcher_support_pkg}{self.constants.patcher_support_pkg_version}/{os_ver}.zip" if Path(self.constants.payload_apple_root_path).exists(): print("- Removing old Apple Binaries folder") Path(self.constants.payload_apple_root_path).unlink() if Path(self.constants.payload_apple_root_path_zip).exists(): print("- Removing old Apple Binaries zip") Path(self.constants.payload_apple_root_path_zip).unlink() Utilities.download_file(link, self.constants.payload_apple_root_path_zip) if self.constants.payload_apple_root_path_zip.exists(): print("- Download completed") print("- Unzipping download...") try: subprocess.run( ["unzip", self.constants.payload_apple_root_path_zip], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=self.constants.payload_path).stdout.decode() print("- Renaming folder") os.rename(self.constants.payload_path / Path(os_ver), self.constants.payload_apple_root_path) Path(self.constants.payload_apple_root_path_zip).unlink() print("- Binaries downloaded to:") print(self.constants.payload_path) if self.constants.gui_mode is False: input("Press [ENTER] to continue") except zipfile.BadZipFile: print("- Couldn't unzip") return else: print("- Download failed, please verify the below link works:") print(link) input("Press [ENTER] to continue")
def change_vault(self): Utilities.cls() Utilities.header(["Set OpenCore Vaulting"]) print( """By default, this patcher will sign all your files and ensure none of the contents can be tampered with. However for more advanced users, you may want to be able to freely edit the config.plist and files. Note: For security reasons, OpenShell will be disabled when Vault is set. """) change_menu = input("Enable Vault(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.vault = True elif change_menu in {"n", "N", "no", "No"}: self.constants.vault = False else: print("Invalid option")
def change_os(self): Utilities.cls() Utilities.header(["Select Patcher's Target OS"]) print(f""" Minimum Target:\t{self.constants.min_os_support} Maximum Target:\t{self.constants.max_os_support} Current target:\t{self.constants.os_support} """) temp_os_support = float(input("Please enter OS target: ")) if (self.constants.max_os_support < temp_os_support) or ( temp_os_support < self.constants.min_os_support): print("Unsupported entry") else: self.constants.os_support = temp_os_support if temp_os_support == 11.0: ModelArray.SupportedSMBIOS = ModelArray.SupportedSMBIOS11 elif temp_os_support == 12.0: ModelArray.SupportedSMBIOS = ModelArray.SupportedSMBIOS12
def custom_color_thing(self): Utilities.cls() Utilities.header(["Set custom CPU Model Name"]) print("""Change reported CPU Model name in About This Mac Custom names will report as follows: 1: Custom Color 2. Reset """) change_menu = input("Set custom CPU Name(1,2,3): ") if change_menu == "1": print("") # temp_tk_root = tk.Tk() # temp_tk_root.wm_withdraw() # self.constants.custom_color = colorchooser.askcolor(title="Choose color") # temp_tk_root.destroy() elif change_menu == "2": self.constants.custom_color = "" else: print("Invalid option")
def drm_setting(self): Utilities.cls() Utilities.header(["Set DRM preferences"]) print("""Sets OpenCore's DRM preferences for iMac13,x and iMac14,x. In Big Sur, some DRM based content may be broken by default in AppleTV, Photobooth, etc. To resolve, you can opt to disable Intel QuickSync support in favor of Nvidia's Software rendering. This can aid in DRM however greatly hampers Video rendering performance in Final Cut Pro and other programs relying on such features. Recommend only disabling if absolutely required. """) change_menu = input("Enable Nvidia's Software DRM rendering(y/n): ") if change_menu in {"y", "Y", "yes", "Yes"}: self.constants.drm_support = True elif change_menu in {"n", "N", "no", "No"}: self.constants.drm_support = False else: print("Invalid option")
def smbios_probe(self): # Reported model entry = next(self.ioregistry.find(name="Root")).children[0] self.reported_model = entry.properties["model"].strip(b"\0").decode() self.reported_board_id = entry.properties.get( "board-id", entry.properties.get("target-type", b"")).strip(b"\0").decode() # Real model # TODO: We previously had logic for OC users using iMacPro1,1 with incorrect ExposeSensitiveData. Add logic? self.real_model = Utilities.get_nvram( "oem-product", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) or self.reported_model self.real_board_id = Utilities.get_nvram( "oem-board", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) or self.reported_board_id # OCLP version self.oclp_version = Utilities.get_nvram( "OCLP-Version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
def allow_nvme(self): Utilities.cls() Utilities.header(["Allow NVMe UEFI Support"]) print(""" For machines not natively supporting NVMe, this option allows you to see and boot NVMe drive in OpenCore's picker Not required if your machine natively supports NVMe Note: You must have OpenCore on a bootable volume first, ie. USB or SATA drive. Once loaded, OpenCore will enable NVMe support in it's picker """) change_menu = input("Enable NVMe Boot support?(y/n): ") if change_menu == "y": self.constants.nvme_boot = True elif change_menu == "n": self.constants.nvme_boot = False else: print("Invalid option")
def allow_firewire(self): Utilities.cls() Utilities.header(["Allow FireWire Boot Support"]) print(""" In macOS Catalina and newer, Apple restricted usage of FireWire devices to boot macOS for security concerns relating to DMA access. If you are comfortable lowering the security, you can re-enable FireWire support for Catalina and newer. Note: MacBook5,x-7,1 don't support FireWire boot """) change_menu = input("Enable FireWire Boot support?(y/n): ") if change_menu == "y": self.constants.firewire_boot = True elif change_menu == "n": self.constants.firewire_boot = False else: print("Invalid option")