Merge branch 'main' into bsd

This commit is contained in:
Jazzzny
2024-06-27 12:55:16 -04:00
26 changed files with 878 additions and 646 deletions

View File

@@ -1,7 +1,13 @@
# OpenCore Legacy Patcher changelog
## 1.6.0
- Set `AssociatedBundleIdentifiers` property in launch services as an array
- Move to auto-generated pre/postinstall scripts for PKGs
- Streamlines PKG creation process, ensuring Install and AutoPKG scripts are always in sync
- Add support for `gktool` in PKG postinstall scripts
- Removes Gatekeeper "verifying" prompt on first launch after PKG installation
- Note `gktool` is only available on macOS Sonoma and newer
- Resolve unpatching crash edge case when host doesn't require patches.
## 1.5.0
- Restructure project directories

View File

@@ -1,103 +0,0 @@
#!/bin/zsh --no-rcs
# ------------------------------------------------------
# AutoPkg Assets Postinstall Script
# ------------------------------------------------------
# Create alias for app, start patching and reboot.
# ------------------------------------------------------
# MARK: PackageKit Parameters
# ---------------------------
pathToScript=$0 # ex. /tmp/PKInstallSandbox.*/Scripts/*/preinstall
pathToPackage=$1 # ex. ~/Downloads/Installer.pkg
pathToTargetLocation=$2 # ex. '/', '/Applications', etc (depends on pkgbuild's '--install-location' argument)
pathToTargetVolume=$3 # ex. '/', '/Volumes/MyVolume', etc
pathToStartupDisk=$4 # ex. '/'
# MARK: Variables
# ---------------------------
helperPath="Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper"
mainAppPath="Library/Application Support/Dortania/OpenCore-Patcher.app"
shimAppPath="Applications/OpenCore-Patcher.app"
executablePath="$mainAppPath/Contents/MacOS/OpenCore-Patcher"
# MARK: Functions
# ---------------------------
function _setSUIDBit() {
local binaryPath=$1
echo "Setting SUID bit on: $binaryPath"
# Check if path is a directory
if [[ -d $binaryPath ]]; then
/bin/chmod -R +s $binaryPath
else
/bin/chmod +s $binaryPath
fi
}
function _createAlias() {
local mainPath=$1
local aliasPath=$2
# Check if alias path exists
if [[ -e $aliasPath ]]; then
# Check if alias path is a symbolic link
if [[ -L $aliasPath ]]; then
echo "Removing old symbolic link: $aliasPath"
/bin/rm -f $aliasPath
else
echo "Removing old file: $aliasPath"
/bin/rm -rf $aliasPath
fi
fi
# Create symbolic link
echo "Creating symbolic link: $aliasPath"
/bin/ln -s $mainPath $aliasPath
}
function _startPatching() {
local executable=$1
local logPath=$(_logFile)
# Start patching
"$executable" "--patch_sys_vol" &> $logPath
}
function _logFile() {
echo "/Users/Shared/.OCLP-AutoPatcher-Log-$(/bin/date +"%Y_%m_%d_%I_%M_%p").txt"
}
function _fixSettingsFilePermission() {
local settingsPath="$pathToTargetVolume/Users/Shared/.com.dortania.opencore-legacy-patcher.plist"
if [[ -e $settingsPath ]]; then
echo "Fixing settings file permissions: $settingsPath"
/bin/chmod 666 $settingsPath
fi
}
function _reboot() {
/sbin/reboot
}
function _main() {
_setSUIDBit "$pathToTargetVolume/$helperPath"
_createAlias "$pathToTargetVolume/$mainAppPath" "$pathToTargetVolume/$shimAppPath"
_startPatching "$pathToTargetVolume/$executablePath"
_fixSettingsFilePermission
_reboot
}
# MARK: Main
# ---------------------------
echo "Starting postinstall script..."
_main

View File

@@ -1,80 +0,0 @@
#!/bin/zsh --no-rcs
# ------------------------------------------------------
# AutoPkg Assets Preinstall Script
# ------------------------------------------------------
# Remove old files, and prepare directories.
# ------------------------------------------------------
# MARK: PackageKit Parameters
# ---------------------------
pathToScript=$0 # ex. /tmp/PKInstallSandbox.*/Scripts/*/preinstall
pathToPackage=$1 # ex. ~/Downloads/Installer.pkg
pathToTargetLocation=$2 # ex. '/', '/Applications', etc (depends on pkgbuild's '--install-location' argument)
pathToTargetVolume=$3 # ex. '/', '/Volumes/MyVolume', etc
pathToStartupDisk=$4 # ex. '/'
# MARK: Variables
# ---------------------------
filesToRemove=(
"Applications/OpenCore-Patcher.app"
"Library/Application Support/Dortania/Update.plist"
"Library/Application Support/Dortania/OpenCore-Patcher.app"
"Library/LaunchAgents/com.dortania.opencore-legacy-patcher.auto-patch.plist"
"Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper"
)
# MARK: Functions
# ---------------------------
function _removeFile() {
local file=$1
if [[ ! -e $file ]]; then
# Check if file is a symbolic link
if [[ -L $file ]]; then
echo "Removing symbolic link: $file"
/bin/rm -f $file
fi
return
fi
echo "Removing file: $file"
# Check if file is a directory
if [[ -d $file ]]; then
/bin/rm -rf $file
else
/bin/rm -f $file
fi
}
function _createParentDirectory() {
local file=$1
local parentDirectory="$(/usr/bin/dirname $file)"
# Check if parent directory exists
if [[ ! -d $parentDirectory ]]; then
echo "Creating parent directory: $parentDirectory"
/bin/mkdir -p $parentDirectory
fi
}
function _main() {
for file in $filesToRemove; do
_removeFile $pathToTargetVolume/$file
_createParentDirectory $pathToTargetVolume/$file
done
}
# MARK: Main
# ---------------------------
echo "Starting preinstall script..."
_main

View File

@@ -2,9 +2,13 @@
package.py: Generate packages (Installer, Uninstaller, AutoPkg-Assets)
"""
import tempfile
import macos_pkg_builder
from opencore_legacy_patcher import constants
from .package_scripts import GenerateScripts
class GeneratePackage:
"""
@@ -63,48 +67,82 @@ class GeneratePackage:
return _welcome
def _generate_autopkg_welcome(self) -> str:
"""
Generate Welcome message for AutoPkg-Assets PKG
"""
_welcome = ""
_welcome += "# DO NOT RUN AUTOPKG-ASSETS MANUALLY!\n\n"
_welcome += "## THIS CAN BREAK YOUR SYSTEM'S INSTALL!\n\n"
_welcome += "This package should only ever be invoked by the Patcher itself, never downloaded or run by the user. Download the OpenCore-Patcher.pkg on the Github Repository.\n\n"
_welcome += f"[OpenCore Legacy Patcher GitHub Release]({constants.Constants().repo_link})"
return _welcome
def generate(self) -> None:
"""
Generate OpenCore-Patcher.pkg
"""
print("Generating OpenCore-Patcher-Uninstaller.pkg")
_tmp_uninstall = tempfile.NamedTemporaryFile(delete=False)
with open(_tmp_uninstall.name, "w") as f:
f.write(GenerateScripts().uninstall())
assert macos_pkg_builder.Packages(
pkg_output="./dist/OpenCore-Patcher-Uninstaller.pkg",
pkg_bundle_id="com.dortania.opencore-legacy-patcher-uninstaller",
pkg_version=constants.Constants().patcher_version,
pkg_background="./ci_tooling/installation_pkg/PkgBackgroundUninstaller.png",
pkg_preinstall_script="./ci_tooling/installation_pkg/uninstall.sh",
pkg_background="./ci_tooling/pkg_assets/PkgBackground-Uninstaller.png",
pkg_preinstall_script=_tmp_uninstall.name,
pkg_as_distribution=True,
pkg_title="OpenCore Legacy Patcher Uninstaller",
pkg_welcome=self._generate_uninstaller_welcome(),
).build() is True
print("Generating OpenCore-Patcher.pkg")
_tmp_pkg_preinstall = tempfile.NamedTemporaryFile(delete=False)
_tmp_pkg_postinstall = tempfile.NamedTemporaryFile(delete=False)
with open(_tmp_pkg_preinstall.name, "w") as f:
f.write(GenerateScripts().preinstall_pkg())
with open(_tmp_pkg_postinstall.name, "w") as f:
f.write(GenerateScripts().postinstall_pkg())
assert macos_pkg_builder.Packages(
pkg_output="./dist/OpenCore-Patcher.pkg",
pkg_bundle_id="com.dortania.opencore-legacy-patcher",
pkg_version=constants.Constants().patcher_version,
pkg_allow_relocation=False,
pkg_as_distribution=True,
pkg_background="./ci_tooling/installation_pkg/PkgBackground.png",
pkg_preinstall_script="./ci_tooling/installation_pkg/preinstall.sh",
pkg_postinstall_script="./ci_tooling/installation_pkg/postinstall.sh",
pkg_background="./ci_tooling/pkg_assets/PkgBackground-Installer.png",
pkg_preinstall_script=_tmp_pkg_preinstall.name,
pkg_postinstall_script=_tmp_pkg_postinstall.name,
pkg_file_structure=self._files,
pkg_title="OpenCore Legacy Patcher",
pkg_welcome=self._generate_installer_welcome(),
).build() is True
print("Generating AutoPkg-Assets.pkg")
_tmp_auto_pkg_preinstall = tempfile.NamedTemporaryFile(delete=False)
_tmp_auto_pkg_postinstall = tempfile.NamedTemporaryFile(delete=False)
with open(_tmp_auto_pkg_preinstall.name, "w") as f:
f.write(GenerateScripts().preinstall_autopkg())
with open(_tmp_auto_pkg_postinstall.name, "w") as f:
f.write(GenerateScripts().postinstall_autopkg())
assert macos_pkg_builder.Packages(
pkg_output="./dist/AutoPkg-Assets.pkg",
pkg_bundle_id="com.dortania.pkg.AutoPkg-Assets",
pkg_version=constants.Constants().patcher_version,
pkg_allow_relocation=False,
pkg_as_distribution=True,
pkg_background="./ci_tooling/autopkg/PkgBackground.png",
pkg_preinstall_script="./ci_tooling/autopkg/preinstall.sh",
pkg_postinstall_script="./ci_tooling/autopkg/postinstall.sh",
pkg_background="./ci_tooling/pkg_assets/PkgBackground-AutoPkg.png",
pkg_preinstall_script=_tmp_auto_pkg_preinstall.name,
pkg_postinstall_script=_tmp_auto_pkg_postinstall.name,
pkg_file_structure=self._autopkg_files,
pkg_title="AutoPkg Assets",
pkg_welcome="# DO NOT RUN AUTOPKG-ASSETS MANUALLY!\n\n## THIS CAN BREAK YOUR SYSTEM'S INSTALL!\n\nThis package should only ever be invoked by the Patcher itself, never downloaded or run by the user. Download the OpenCore-Patcher.pkg on the Github Repository.\n\n[OpenCore Legacy Patcher GitHub Release](https://github.com/dortania/OpenCore-Legacy-Patcher/releases/)",
pkg_welcome=self._generate_autopkg_welcome(),
).build() is True

View File

@@ -0,0 +1,556 @@
"""
package_scripts.py: Generate pre/postinstall scripts for PKG and AutoPkg
"""
class ZSHFunctions:
def __init__(self) -> None:
pass
def generate_standard_pkg_parameters(self) -> str:
"""
ZSH variables for standard PackageKit parameters
"""
_script = ""
_script += "# MARK: PackageKit Parameters\n"
_script += "# " + "-" * 27 + "\n\n"
_script += "pathToScript=$0 # ex. /tmp/PKInstallSandbox.*/Scripts/*/preinstall\n"
_script += "pathToPackage=$1 # ex. ~/Downloads/Installer.pkg\n"
_script += "pathToTargetLocation=$2 # ex. '/', '/Applications', etc (depends on pkgbuild's '--install-location' argument)\n"
_script += "pathToTargetVolume=$3 # ex. '/', '/Volumes/MyVolume', etc\n"
_script += "pathToStartupDisk=$4 # ex. '/'\n"
return _script
def generate_script_remove_file(self) -> str:
"""
ZSH function to remove files
"""
_script = ""
_script += "function _removeFile() {\n"
_script += " local file=$1\n\n"
_script += " if [[ ! -e $file ]]; then\n"
_script += " # Check if file is a symbolic link\n"
_script += " if [[ -L $file ]]; then\n"
_script += " echo \"Removing symbolic link: $file\"\n"
_script += " /bin/rm -f $file\n"
_script += " fi\n"
_script += " return\n"
_script += " fi\n\n"
_script += " echo \"Removing file: $file\"\n\n"
_script += " # Check if file is a directory\n"
_script += " if [[ -d $file ]]; then\n"
_script += " /bin/rm -rf $file\n"
_script += " else\n"
_script += " /bin/rm -f $file\n"
_script += " fi\n"
_script += "}\n"
return _script
def generate_script_create_parent_directory(self) -> str:
"""
ZSH function to create parent directory
"""
_script = ""
_script += "function _createParentDirectory() {\n"
_script += " local file=$1\n\n"
_script += " local parentDirectory=\"$(/usr/bin/dirname $file)\"\n\n"
_script += " # Check if parent directory exists\n"
_script += " if [[ ! -d $parentDirectory ]]; then\n"
_script += " echo \"Creating parent directory: $parentDirectory\"\n"
_script += " /bin/mkdir -p $parentDirectory\n"
_script += " fi\n"
_script += "}\n"
return _script
def generate_set_suid_bit(self) -> str:
"""
ZSH function to set SUID bit
"""
_script = ""
_script += "function _setSUIDBit() {\n"
_script += " local binaryPath=$1\n\n"
_script += " echo \"Setting SUID bit on: $binaryPath\"\n\n"
_script += " # Check if path is a directory\n"
_script += " if [[ -d $binaryPath ]]; then\n"
_script += " /bin/chmod -R +s $binaryPath\n"
_script += " else\n"
_script += " /bin/chmod +s $binaryPath\n"
_script += " fi\n"
_script += "}\n"
return _script
def generate_create_alias(self) -> str:
"""
ZSH function to create alias
"""
_script = ""
_script += "function _createAlias() {\n"
_script += " local mainPath=$1\n"
_script += " local aliasPath=$2\n\n"
_script += " # Check if alias path exists\n"
_script += " if [[ -e $aliasPath ]]; then\n"
_script += " # Check if alias path is a symbolic link\n"
_script += " if [[ -L $aliasPath ]]; then\n"
_script += " echo \"Removing old symbolic link: $aliasPath\"\n"
_script += " /bin/rm -f $aliasPath\n"
_script += " else\n"
_script += " echo \"Removing old file: $aliasPath\"\n"
_script += " /bin/rm -rf $aliasPath\n"
_script += " fi\n"
_script += " fi\n\n"
_script += " # Create symbolic link\n"
_script += " echo \"Creating symbolic link: $aliasPath\"\n"
_script += " /bin/ln -s $mainPath $aliasPath\n"
_script += "}\n"
return _script
def generate_start_patching(self) -> str:
"""
ZSH function to start patching
"""
_script = ""
_script += "function _startPatching() {\n"
_script += " local executable=$1\n"
_script += " local logPath=$(_logFile)\n\n"
_script += " # Start patching\n"
_script += " \"$executable\" \"--patch_sys_vol\" &> $logPath\n"
_script += "}\n"
return _script
def generate_log_file(self) -> str:
"""
ZSH function to generate log file
"""
_script = ""
_script += "function _logFile() {\n"
_script += " echo \"/Users/Shared/.OCLP-AutoPatcher-Log-$(/bin/date +\"%Y_%m_%d_%I_%M_%p\").txt\"\n"
_script += "}\n"
return _script
def generate_fix_settings_file_permission(self) -> str:
"""
ZSH function to fix settings file permission
"""
_script = ""
_script += "function _fixSettingsFilePermission() {\n"
_script += " local settingsPath=\"$pathToTargetVolume/Users/Shared/.com.dortania.opencore-legacy-patcher.plist\"\n\n"
_script += " if [[ -e $settingsPath ]]; then\n"
_script += " echo \"Fixing settings file permissions: $settingsPath\"\n"
_script += " /bin/chmod 666 $settingsPath\n"
_script += " fi\n"
_script += "}\n"
return _script
def generate_reboot(self) -> str:
"""
ZSH function to reboot
"""
_script = ""
_script += "function _reboot() {\n"
_script += " /sbin/reboot\n"
_script += "}\n"
return _script
def generate_prewarm_gatekeeper(self) -> str:
"""
ZSH function to prewarm Gatekeeper
"""
_script = ""
_script += "function _prewarmGatekeeper() {\n"
_script += " local appPath=$1\n\n"
_script += " # Check if /usr/bin/gktool exists\n"
_script += " if [[ ! -e /usr/bin/gktool ]]; then\n"
_script += " echo \"Host doesn't support Gatekeeper prewarming, skipping...\"\n"
_script += " return\n"
_script += " fi\n\n"
_script += " echo \"Prewarming Gatekeeper for application: $appPath\"\n"
_script += " /usr/bin/gktool scan $appPath\n"
_script += "}\n"
return _script
def generate_clean_launch_service(self) -> str:
"""
ZSH function to clean Launch Service
"""
_script = ""
_script += "function _cleanLaunchService() {\n"
_script += " local domain=\"com.dortania.opencore-legacy-patcher\"\n\n"
_script += " # Iterate over launch agents and daemons\n"
_script += " for launchServiceVariant in \"$pathToTargetVolume/Library/LaunchAgents\" \"$pathToTargetVolume/Library/LaunchDaemons\"; do\n"
_script += " # Check if directory exists\n"
_script += " if [[ ! -d $launchServiceVariant ]]; then\n"
_script += " continue\n"
_script += " fi\n\n"
_script += " # Iterate over launch service files\n"
_script += " for launchServiceFile in $(/bin/ls -1 $launchServiceVariant | /usr/bin/grep $domain); do\n"
_script += " local launchServicePath=\"$launchServiceVariant/$launchServiceFile\"\n\n"
_script += " # Remove launch service file\n"
_script += " _removeFile $launchServicePath\n"
_script += " done\n"
_script += " done\n"
_script += "}\n"
return _script
def generate_preinstall_main(self) -> str:
"""
ZSH function for preinstall's main
"""
_script = ""
_script += "function _main() {\n"
_script += " for file in $filesToRemove; do\n"
_script += " _removeFile $pathToTargetVolume/$file\n"
_script += " _createParentDirectory $pathToTargetVolume/$file\n"
_script += " done\n"
_script += "}\n"
return _script
def generate_postinstall_main(self, is_autopkg: bool = False) -> str:
"""
ZSH function for postinstall's main
"""
_script = ""
_script += "function _main() {\n"
_script += " _setSUIDBit \"$pathToTargetVolume/$helperPath\"\n"
_script += " _createAlias \"$pathToTargetVolume/$mainAppPath\" \"$pathToTargetVolume/$shimAppPath\"\n"
_script += " _prewarmGatekeeper \"$pathToTargetVolume/$mainAppPath\"\n"
if is_autopkg:
_script += " _startPatching \"$pathToTargetVolume/$executablePath\"\n"
_script += " _fixSettingsFilePermission\n"
_script += " _reboot\n"
_script += "}\n"
return _script
def generate_uninstall_main(self) -> str:
"""
ZSH function for uninstall's main
"""
_script = ""
_script += "function _main() {\n"
_script += " _cleanLaunchService\n"
_script += " for file in $filesToRemove; do\n"
_script += " _removeFile $pathToTargetVolume/$file\n"
_script += " done\n"
_script += "}\n"
return _script
class GenerateScripts:
def __init__(self):
self.zsh_functions = ZSHFunctions()
self.files = [
"Applications/OpenCore-Patcher.app",
"Library/Application Support/Dortania/Update.plist",
"Library/Application Support/Dortania/OpenCore-Patcher.app",
"Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper"
]
self.additional_auto_pkg_files = [
"Library/LaunchAgents/com.dortania.opencore-legacy-patcher.auto-patch.plist"
]
def __generate_shebang(self) -> str:
"""
Standard shebang for ZSH
"""
return "#!/bin/zsh --no-rcs\n"
def _generate_header_bar(self) -> str:
"""
# ------------------------------------------------------
"""
return "# " + "-" * 54 + "\n"
def _generate_label_bar(self) -> str:
"""
# ------------------------------
"""
return "# " + "-" * 27 + "\n"
def _generate_preinstall_script(self, is_autopkg: bool = False) -> str:
"""
Generate preinstall script for PKG
"""
_script = ""
_script += self.__generate_shebang()
_script += self._generate_header_bar()
_script += f"# {'AutoPkg Assets' if is_autopkg else 'OpenCore Legacy Patcher'} Preinstall Script\n"
_script += self._generate_header_bar()
_script += "# Remove old files, and prepare directories.\n"
_script += self._generate_header_bar()
_script += "\n\n"
_script += self.zsh_functions.generate_standard_pkg_parameters()
_script += "\n\n"
_script += "# MARK: Variables\n"
_script += self._generate_label_bar()
_script += "\n"
_files = self.files
if is_autopkg:
_files += self.additional_auto_pkg_files
_script += f"filesToRemove=(\n"
for _file in _files:
_script += f" \"{_file}\"\n"
_script += ")\n"
_script += "\n\n"
_script += "# MARK: Functions\n"
_script += self._generate_label_bar()
_script += "\n"
_script += self.zsh_functions.generate_script_remove_file()
_script += "\n"
_script += self.zsh_functions.generate_script_create_parent_directory()
_script += "\n"
_script += self.zsh_functions.generate_preinstall_main()
_script += "\n\n"
_script += "# MARK: Main\n"
_script += self._generate_label_bar()
_script += "\n"
_script += "echo \"Starting preinstall script...\"\n"
_script += "_main\n"
return _script
def _generate_postinstall_script(self, is_autopkg: bool = False) -> str:
"""
"""
_script = ""
_script += self.__generate_shebang()
_script += self._generate_header_bar()
_script += f"# {'AutoPkg Assets' if is_autopkg else 'OpenCore Legacy Patcher'} Post Install Script\n"
_script += self._generate_header_bar()
if is_autopkg:
_script += "# Set UID, create alias, start patching, and reboot.\n"
else:
_script += "# Set SUID bit on helper tool, and create app alias.\n"
_script += self._generate_header_bar()
_script += "\n\n"
_script += self.zsh_functions.generate_standard_pkg_parameters()
_script += "\n\n"
_script += "# MARK: Variables\n"
_script += self._generate_label_bar()
_script += "\n"
_script += "helperPath=\"Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper\"\n"
_script += "mainAppPath=\"Library/Application Support/Dortania/OpenCore-Patcher.app\"\n"
_script += "shimAppPath=\"Applications/OpenCore-Patcher.app\"\n"
if is_autopkg:
_script += "executablePath=\"$mainAppPath/Contents/MacOS/OpenCore-Patcher\"\n"
_script += "\n\n"
_script += "# MARK: Functions\n"
_script += self._generate_label_bar()
_script += "\n"
_script += self.zsh_functions.generate_set_suid_bit()
_script += "\n"
_script += self.zsh_functions.generate_create_alias()
_script += "\n"
_script += self.zsh_functions.generate_prewarm_gatekeeper()
_script += "\n"
if is_autopkg:
_script += self.zsh_functions.generate_start_patching()
_script += "\n"
_script += self.zsh_functions.generate_log_file()
_script += "\n"
_script += self.zsh_functions.generate_fix_settings_file_permission()
_script += "\n"
_script += self.zsh_functions.generate_reboot()
_script += "\n"
_script += self.zsh_functions.generate_postinstall_main(is_autopkg)
_script += "\n\n"
_script += "# MARK: Main\n"
_script += self._generate_label_bar()
_script += "\n"
_script += "echo \"Starting postinstall script...\"\n"
_script += "_main\n"
return _script
def _generate_uninstall_script(self) -> str:
"""
"""
_script = ""
_script += self.__generate_shebang()
_script += self._generate_header_bar()
_script += f"# OpenCore Legacy Patcher Uninstall Script\n"
_script += self._generate_header_bar()
_script += "# Remove OpenCore Legacy Patcher files and directories.\n"
_script += self._generate_header_bar()
_script += "\n\n"
_script += self.zsh_functions.generate_standard_pkg_parameters()
_script += "\n\n"
_script += "# MARK: Variables\n"
_script += self._generate_label_bar()
_script += "\n"
_files = self.files
_script += "filesToRemove=(\n"
for _file in _files:
_script += f" \"{_file}\"\n"
_script += ")\n"
_script += "\n\n"
_script += "# MARK: Functions\n"
_script += self._generate_label_bar()
_script += "\n"
_script += self.zsh_functions.generate_script_remove_file()
_script += "\n"
_script += self.zsh_functions.generate_clean_launch_service()
_script += "\n"
_script += self.zsh_functions.generate_uninstall_main()
_script += "\n\n"
_script += "# MARK: Main\n"
_script += self._generate_label_bar()
_script += "\n"
_script += "echo \"Starting uninstall script...\"\n"
_script += "_main\n"
return _script
def preinstall_pkg(self) -> str:
"""
Generate preinstall script for PKG
"""
return self._generate_preinstall_script()
def preinstall_autopkg(self) -> str:
"""
Generate preinstall script for AutoPkg
"""
return self._generate_preinstall_script(is_autopkg=True)
def postinstall_pkg(self) -> str:
"""
Generate postinstall script for PKG
"""
return self._generate_postinstall_script()
def postinstall_autopkg(self) -> str:
"""
Generate postinstall script for AutoPkg
"""
return self._generate_postinstall_script(is_autopkg=True)
def uninstall(self) -> str:
"""
Generate uninstall script
"""
return self._generate_uninstall_script()

View File

@@ -1,74 +0,0 @@
#!/bin/zsh --no-rcs
# ------------------------------------------------------
# OpenCore Legacy Patcher PKG Post Install Script
# ------------------------------------------------------
# Set SUID bit on helper tool, and create app alias.
# ------------------------------------------------------
# MARK: PackageKit Parameters
# ---------------------------
pathToScript=$0 # ex. /tmp/PKInstallSandbox.*/Scripts/*/preinstall
pathToPackage=$1 # ex. ~/Downloads/Installer.pkg
pathToTargetLocation=$2 # ex. '/', '/Applications', etc (depends on pkgbuild's '--install-location' argument)
pathToTargetVolume=$3 # ex. '/', '/Volumes/MyVolume', etc
pathToStartupDisk=$4 # ex. '/'
# MARK: Variables
# ---------------------------
helperPath="Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper"
mainAppPath="Library/Application Support/Dortania/OpenCore-Patcher.app"
shimAppPath="Applications/OpenCore-Patcher.app"
# MARK: Functions
# ---------------------------
function _setSUIDBit() {
local binaryPath=$1
echo "Setting SUID bit on: $binaryPath"
# Check if path is a directory
if [[ -d $binaryPath ]]; then
/bin/chmod -R +s $binaryPath
else
/bin/chmod +s $binaryPath
fi
}
function _createAlias() {
local mainPath=$1
local aliasPath=$2
# Check if alias path exists
if [[ -e $aliasPath ]]; then
# Check if alias path is a symbolic link
if [[ -L $aliasPath ]]; then
echo "Removing old symbolic link: $aliasPath"
/bin/rm -f $aliasPath
else
echo "Removing old file: $aliasPath"
/bin/rm -rf $aliasPath
fi
fi
# Create symbolic link
echo "Creating symbolic link: $aliasPath"
/bin/ln -s $mainPath $aliasPath
}
function _main() {
_setSUIDBit "$pathToTargetVolume/$helperPath"
_createAlias "$pathToTargetVolume/$mainAppPath" "$pathToTargetVolume/$shimAppPath"
}
# MARK: Main
# ---------------------------
echo "Starting postinstall script..."
_main

View File

@@ -1,79 +0,0 @@
#!/bin/zsh --no-rcs
# ------------------------------------------------------
# OpenCore Legacy Patcher PKG Preinstall Script
# ------------------------------------------------------
# Remove old files, and prepare directories.
# ------------------------------------------------------
# MARK: PackageKit Parameters
# ---------------------------
pathToScript=$0 # ex. /tmp/PKInstallSandbox.*/Scripts/*/preinstall
pathToPackage=$1 # ex. ~/Downloads/Installer.pkg
pathToTargetLocation=$2 # ex. '/', '/Applications', etc (depends on pkgbuild's '--install-location' argument)
pathToTargetVolume=$3 # ex. '/', '/Volumes/MyVolume', etc
pathToStartupDisk=$4 # ex. '/'
# MARK: Variables
# ---------------------------
filesToRemove=(
"Applications/OpenCore-Patcher.app"
"Library/Application Support/Dortania/Update.plist"
"Library/Application Support/Dortania/OpenCore-Patcher.app"
"Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper"
)
# MARK: Functions
# ---------------------------
function _removeFile() {
local file=$1
if [[ ! -e $file ]]; then
# Check if file is a symbolic link
if [[ -L $file ]]; then
echo "Removing symbolic link: $file"
/bin/rm -f $file
fi
return
fi
echo "Removing file: $file"
# Check if file is a directory
if [[ -d $file ]]; then
/bin/rm -rf $file
else
/bin/rm -f $file
fi
}
function _createParentDirectory() {
local file=$1
local parentDirectory="$(/usr/bin/dirname $file)"
# Check if parent directory exists
if [[ ! -d $parentDirectory ]]; then
echo "Creating parent directory: $parentDirectory"
/bin/mkdir -p $parentDirectory
fi
}
function _main() {
for file in $filesToRemove; do
_removeFile $pathToTargetVolume/$file
_createParentDirectory $pathToTargetVolume/$file
done
}
# MARK: Main
# ---------------------------
echo "Starting preinstall script..."
_main

View File

@@ -1,85 +0,0 @@
#!/bin/zsh --no-rcs
# ------------------------------------------------------
# OpenCore Legacy Patcher PKG Uninstall Script
# ------------------------------------------------------
# MARK: PackageKit Parameters
# ---------------------------
pathToScript=$0 # ex. /tmp/PKInstallSandbox.*/Scripts/*/preinstall
pathToPackage=$1 # ex. ~/Downloads/Installer.pkg
pathToTargetLocation=$2 # ex. '/', '/Applications', etc (depends on pkgbuild's '--install-location' argument)
pathToTargetVolume=$3 # ex. '/', '/Volumes/MyVolume', etc
pathToStartupDisk=$4 # ex. '/'
# MARK: Variables
# ---------------------------
filesToRemove=(
"Applications/OpenCore-Patcher.app"
"Library/Application Support/Dortania/Update.plist"
"Library/Application Support/Dortania/OpenCore-Patcher.app"
"Library/PrivilegedHelperTools/com.dortania.opencore-legacy-patcher.privileged-helper"
)
# MARK: Functions
# ---------------------------
function _removeFile() {
local file=$1
if [[ ! -e $file ]]; then
# Check if file is a symbolic link
if [[ -L $file ]]; then
echo "Removing symbolic link: $file"
/bin/rm -f $file
fi
return
fi
echo "Removing file: $file"
# Check if file is a directory
if [[ -d $file ]]; then
/bin/rm -rf $file
else
/bin/rm -f $file
fi
}
function _cleanLaunchService() {
local domain="com.dortania.opencore-legacy-patcher"
# Iterate over launch agents and daemons
for launchServiceVariant in "$pathToTargetVolume/Library/LaunchAgents" "$pathToTargetVolume/Library/LaunchDaemons"; do
# Check if directory exists
if [[ ! -d $launchServiceVariant ]]; then
continue
fi
# Iterate over launch service files
for launchServiceFile in $(/bin/ls -1 $launchServiceVariant | /usr/bin/grep $domain); do
local launchServicePath="$launchServiceVariant/$launchServiceFile"
# Remove launch service file
_removeFile $launchServicePath
done
done
}
function _main() {
_cleanLaunchService
for file in $filesToRemove; do
_removeFile "$pathToTargetVolume/$file"
done
}
# MARK: Main
# ---------------------------
echo "Starting uninstall script..."
_main

View File

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 156 KiB

View File

Before

Width:  |  Height:  |  Size: 320 KiB

After

Width:  |  Height:  |  Size: 320 KiB

View File

Before

Width:  |  Height:  |  Size: 160 KiB

After

Width:  |  Height:  |  Size: 160 KiB

View File

@@ -131,6 +131,7 @@ module.exports = {
'ICNS',
'WINDOWS',
'UNIVERSALCONTROL',
'PROCESS',
]
},
{

19
docs/PROCESS.md Normal file
View File

@@ -0,0 +1,19 @@
# Background process
OpenCore Legacy Patcher utilizes a background process to:
- Check for mismatched configurations and warn the user (e.g. installed MacBookPro11,1 config on MacBookPro11,5)
- Monitor the status of installed Root Patches and OpenCore
- Ask you to install Root Patches in case they aren't detected (typically after an update)
- Check whether OpenCore is being booted from USB drive or internal drive
- Ask you to install OpenCore on the internal disk in case booted from USB
- React to upcoming updates requiring a new KDK to be downloaded, starting KDK download automatically
It is recommended to keep the background process enabled for smoothest functionality. e.g. to try and avoid failed patching when new KDK is not found.
If you decide to disable the background process, the KDK installation for each update has to be done manually. OCLP is also unable to detect Root Patches on boot, meaning manually opening the app and root patching is required.
::: warning Note:
In some cases macOS may report background process being added by "Mykola Grymalyuk", this happens due to a macOS bug where sometimes the developer name who sent the app for notarization is shown instead of the application name.
Dortania cannot do anything about this.
:::

View File

@@ -1,206 +1,230 @@
# Troubleshooting
Here are some common errors that users may experience while using this patcher:
* [OpenCore Legacy Patcher not launching](#opencore-legacy-patcher-not-launching)
* [Stuck on `This version of Mac OS X is not supported on this platform` or (🚫) Prohibited Symbol](#stuck-on-this-version-of-mac-os-x-is-not-supported-on-this-platform-or-(🚫)-prohibited-symbol)
* [Cannot boot macOS without the USB](#cannot-boot-macos-without-the-usb)
* [Infinite Recovery OS Booting](#infinite-recovery-os-reboot)
* [Stuck on boot after root patching](#stuck-on-boot-after-root-patching)
* [Reboot when entering Hibernation (`Sleep Wake Failure`)](#reboot-when-entering-hibernation-sleep-wake-failure)
* [How to Boot Recovery through OpenCore Legacy Patcher](#how-to-boot-recovery-through-opencore-legacy-patcher)
* [Stuck on "Your Mac needs a firmware update"](#stuck-on-your-mac-needs-a-firmware-update)
* [No Brightness Control](#no-brightness-control)
* [Cannot connect Wi-Fi on Monterey with legacy cards](#cannot-connect-Wi-Fi-on-Monterey-with-legacy-cards)
* [No Graphics Acceleration](#no-graphics-acceleration)
* [Black Screen on MacBookPro11,3 in macOS Monterey](#black-screen-on-macbookpro113-in-macos-monterey)
* [No DisplayPort Output on Mac Pros with NVIDIA Kepler](#no-displayport-output-on-mac-pros-with-NVIDIA-kepler)
* [Volume Hash Mismatch Error in macOS Monterey](#volume-hash-mismatch-error-in-macos-monterey)
* [Cannot Disable SIP in recoveryOS](#cannot-disable-sip-in-recoveryos)
* [Stuck on "Less than a minute remaining..."](#stuck-on-less-than-a-minute-remaining)
* [No acceleration after a Metal GPU swap on Mac Pro](#no-acceleration-after-a-metal-gpu-swap-on-mac-pro)
* [Keyboard, Mouse and Trackpad not working in installer or after update](#keyboard-mouse-and-trackpad-not-working-in-installer-or-after-update)
## OpenCore Legacy Patcher not launching
If the application won't launch (e.g. icon will bounce in the Dock), try launching OCLP via Terminal by typing the following command, make sure you've moved the app to `/Applications` before this.
```sh
/Applications/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
```
## Stuck on `This version of Mac OS X is not supported on this platform` or (🚫) Prohibited Symbol
This means macOS has detected an SMBIOS it does not support. To resolve this, ensure you're booting OpenCore **before** the macOS installer in the boot picker. Reminder that the option will be called `EFI Boot`.
Once you've booted OpenCore at least once, your hardware should now auto-boot it until either an NVRAM reset occurs, or you remove the drive with OpenCore installed.
However, if the 🚫 Symbol only appears after the boot process has already started (the bootscreen appears/verbose boot starts), it could mean that your USB drive has failed to pass macOS' integrity checks. To resolve this, create a new installer using a different USB drive (preferably of a different model.)
## Cannot boot macOS without the USB
By default, the OpenCore Patcher won't install OpenCore onto the internal drive itself during installs.
After installing macOS, OpenCore Legacy Patcher should automatically prompt you to install OpenCore onto the internal drive. However, if it doesn't show the prompt, you'll need to either [manually transfer](https://dortania.github.io/OpenCore-Post-Install/universal/oc2hdd.html) OpenCore to the internal drive's EFI or Build and Install again and select your internal drive.
Reminder that once this is done, you'll need to select OpenCore in the boot picker again for your hardware to remember this entry and auto boot from then on.
## Infinite Recovery OS Booting
With OpenCore Legacy Patcher, we rely on Apple Secure Boot to ensure OS updates work correctly and reliably with Big Sur. However this installs NVRAM variables that will confuse your Mac if not running with OpenCore. To resolve this, simply uninstall OpenCore and [reset NVRAM](https://support.apple.com/en-mide/HT201255).
* Note: Machines with modified root volumes will also result in an infinite recovery loop until integrity is restored.
## Stuck on boot after root patching
Boot into recovery by pressing space when your disk is selected on the OCLP bootpicker (if you have it hidden, hold ESC while starting up)
* **Note:** If your disk name is something else than "Macintosh HD", make sure to change the path accordingly. You can figure out your disk name by typing `ls /Volumes`.
Go into terminal and first mount the disk by typing
```sh
mount -uw "/Volumes/Macintosh HD"
```
Then revert the snapshot
```sh
bless --mount "/Volumes/Macintosh HD" --bootefi --last-sealed-snapshot
```
Now we're going to clean the /Library/Extensions folder from offending kexts while keeping needed ones.
Run the following and **make sure to type it carefully**
::: warning
If you have **FileVault 2 enabled**, you will need to mount the Data volume first. This can be done in Disk Utility by locating your macOS volume name, selecting its Data volume, and selecting the Mount option in the toolbar.
:::
```sh
cd "/Volumes/Macintosh HD - Data/Library/Extensions" && ls | grep -v "HighPoint*\|SoftRAID*" | xargs rm -rf
```
Then restart and now your system should be restored to the unpatched snapshot and should be able to boot again.
## Reboot when entering Hibernation (`Sleep Wake Failure`)
[Known issue on some models](https://github.com/dortania/Opencore-Legacy-Patcher/issues/72), a temporary fix is to disable Hibernation by executing the following command in the terminal:
```
sudo pmset -a hibernatemode 0
```
## How to Boot Recovery through OpenCore Legacy Patcher
By default, the patcher will try to hide extra boot options such as recovery from the user. To make them appear, simply press the `Spacebar` key while inside OpenCore's Picker to list all boot options.
## Stuck on "Your Mac needs a firmware update"
Full error: "Your Mac needs a firmware update in order to install to this Volume. Please select a Mac OS Extended (Journaled) volume instead."
This error occurs when macOS determines that the current firmware does not have full APFS support. To resolve this, when installing OpenCore, head to "Patcher Settings" and enable "Moderate SMBIOS Patching" or higher. This will ensure that the firmware reported will show support for full APFS capabilities.
## No Brightness Control
With OCLP v0.0.22, we've added support for brightness control on many models. However, some users may have noticed that their brightness keys do not work.
As a work-around, we recommend users try out the below app:
* [Brightness Slider](https://actproductions.net/free-apps/brightness-slider/)
## Cannot connect Wi-Fi on Monterey with legacy cards
With OCLP v0.2.5, we've added support for legacy Wi-Fi on Monterey. However, some users may have noticed that they can't connect to wireless networks.
To work-around this, we recommend that users manually connect using the "Other" option in the Wi-Fi menu bar or manually adding the network in the "Network" preference pane.
## No Graphics Acceleration
In macOS, GPU drivers are often dropped from the OS with each major release of it. With macOS Big Sur, currently, all non-Metal GPUs require additional patches to gain acceleration. In addition, macOS Monterey removed Graphics Drivers for both Intel Ivy Bridge and NVIDIA Kepler graphics processors.
If you're using OCLP v0.4.4, you should have been prompted to install Root Volume patches after the first boot from installation of macOS. If you need to do this manually, you can do so within the patcher app. Once rebooted, acceleration will be re-enabled as well as brightness control for laptops.
## Black Screen on MacBookPro11,3 in macOS Monterey
Due to Apple dropping NVIDIA Kepler support in macOS Monterey, [MacBookPro11,3's GMUX has difficulties switching back to the iGPU to display macOS correctly.](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/522) To work-around this issue, boot the MacBookPro11,3 in Safe Mode and once macOS is installed, run OCLP's Post Install Root Patches to enable GPU Acceleration for the NVIDIA dGPU.
* Safe Mode can be started by holding `Shift` + `Enter` when selecting macOS Monterey in OCLP's Boot Menu.
## No DisplayPort Output on Mac Pros with NVIDIA Kepler
If you're having trouble with DisplayPort output on Mac Pros, try enabling Minimal Spoofing in Settings -> SMBIOS Settings and rebuild/install OpenCore. This will trick macOS drivers into thinking you have a newer MacPro7,1 and resolve the issue.
![](./images/OCLP-GUI-SMBIOS-Minimal.png)
## Volume Hash Mismatch Error in macOS Monterey
A semi-common popup some users face is the "Volume Hash Mismatch" error:
<p align="center">
<img src="./images/Hash-Mismatch.png">
</p>
What this error signifies is that the OS detects that the boot volume's hash does not match what the OS is expecting, this error is generally cosmetic and can be ignored. However if your system starts to crash spontaneously shortly after, you'll want to reinstall macOS fresh without importing any data at first.
* Note that this bug affects native Macs as well and is not due to issues with unsupported Macs: [OSX Daily: “Volume Hash Mismatch” Error in MacOS Monterey](https://osxdaily.com/2021/11/10/volume-hash-mismatch-error-in-macos-monterey/)
Additionally, it can help to disable FeatureUnlock in Settings -> Misc Settings as this tool can be strenuous on systems with weaker memory stability.
## Cannot Disable SIP in recoveryOS
With OCLP, the patcher will always overwrite the current SIP value on boot to ensure that users don't brick an installation after an NVRAM reset. However, for users wanting to disable SIP entirely, this can be done easily.
Head into the GUI, go to Patcher Settings, and toggle the bits you need disabled from SIP:
| SIP Enabled | SIP Lowered (Root Patching) | SIP Disabled |
| :--- | :--- | :--- |
| ![](./images/OCLP-GUI-Settings-SIP-Enabled.png) | ![](./images/OCLP-GUI-Settings-SIP-Root-Patch.png) | ![](./images/OCLP-GUI-Settings-SIP-Disabled.png) |
## Intermediate issues with USB 1.1 and Bluetooth on MacPro3,1 - MacPro5,1
For those experiencing issues with USB 1.1 devices (such as mice, keyboards and bluetooth chipsets), macOS Big Sur and newer have weakened OS-side reliability for the UHCI controller in older Mac Pros.
* UHCI is a USB 1.1 controller that is hooked together with the USB 2.0 ports in your system. Whenever a USB 1.1 device is detected, the UHCI controller is given ownership of the device at a hardware/firmware level.
* EHCI is the USB 2.0 controller in older Mac Pros
Because of this, we recommend placing a USB 2.0/3.0 hub between your devices and the port on the Mac Pro. UHCI and EHCI cannot both be used at once, so using a USB hub will always force the EHCI controller on.
* Alternatively, you can try cold-starting the hardware and see if macOS recognizes the UHCI controller properly.
## Stuck on "Less than a minute remaining..."
A common area for systems to get "stuck", namely for units that are missing the `AES` CPU instruction/older mobile hardware. During this stage, a lot of heavy cryptography is performed, which can make systems appear to be stuck. In reality they are working quite hard to finish up the installation.
Because this step can take a few hours or more depending on drive speeds, be patient at this stage and do not manually power off or reboot your machine as this will break the installation and require you to reinstall. If you think your system has stalled, press the Caps Lock key. If the light turns on, your system is busy and not actually frozen.
## No acceleration after a Metal GPU swap on Mac Pro
If you finished installing Monterey with the original card installed (to see bootpicker for example) and swapped your GPU to a Metal supported one, you may notice that you're missing acceleration. To fix this, open OCLP and revert root patches to get your Metal-supported GPU work again.
Alternatively, you can remove "AutoPkg-Assets.pkg" from /Library/Packages on the USB drive before proceeding with the installation. To see the folder, enable hidden files with `Command` + `Shift` + `.`
The reason for this is that the autopatcher will assume that you will be using the original graphics card and therefore does non-metal patching, which includes removing some drivers for other cards. This causes Metal cards to not accelerate after swapping.
## Keyboard, Mouse and Trackpad not working in installer or after update
For Macs using legacy USB 1.1 controllers, OpenCore Legacy Patcher can only restore support once it has performed root volume patches. Thus to install macOS, you need to hook up a USB hub between your Mac and Keyboard/Mouse.
* For MacBook users, you'll need to find an external keyboard/mouse in addition to the USB hub
More information can be found here:
* [Legacy UHCI/OHCI support in Ventura #1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021)
Applicable models include:
| Family | Year | Model | Notes |
| :---------- | :--------------------| :---------------------------- | :----------------------------------------------- |
| MacBook | Mid 2010 and older | MacBook5,1 - MacBook7,1 | |
| MacBook Air | Late 2010 and older | MacBookAir2,1 - MacBookAir3,x | |
| MacBook Pro | Mid 2010 and older | MacBookPro4,1 - MacBookPro7,x | Excludes Mid 2010 15" and 17" (MacBookPro6,x) |
| iMac | Late 2009 and older | iMac7,1 - iMac10,x | Excludes Core i5/7 27" late 2009 iMac (iMac11,1) |
| Mac mini | Mid 2011 and older | Macmini3,1 - Macmini5,x | |
| Mac Pro | Mid 2010 and older | MacPro3,1 - MacPro5,1 | |
![](./images/usb11-chart.png)
# Troubleshooting
Here are some common errors that users may experience while using this patcher:
* [OpenCore Legacy Patcher not launching](#opencore-legacy-patcher-not-launching)
* ["You don't have permission to save..." error when creating USB installer](#you-dont-have-permission-to-save-error-when-creating-usb-installer)
* [Stuck on `This version of Mac OS X is not supported on this platform` or (🚫) Prohibited Symbol](#stuck-on-this-version-of-mac-os-x-is-not-supported-on-this-platform-or-(🚫)-prohibited-symbol)
* [Cannot boot macOS without the USB](#cannot-boot-macos-without-the-usb)
* [Infinite Recovery OS Booting](#infinite-recovery-os-reboot)
* [Stuck on boot after root patching](#stuck-on-boot-after-root-patching)
* [Reboot when entering Hibernation (`Sleep Wake Failure`)](#reboot-when-entering-hibernation-sleep-wake-failure)
* [How to Boot Recovery through OpenCore Legacy Patcher](#how-to-boot-recovery-through-opencore-legacy-patcher)
* [Stuck on "Your Mac needs a firmware update"](#stuck-on-your-mac-needs-a-firmware-update)
* [No Brightness Control](#no-brightness-control)
* [Cannot connect Wi-Fi on Monterey with legacy cards](#cannot-connect-Wi-Fi-on-Monterey-with-legacy-cards)
* [No Graphics Acceleration](#no-graphics-acceleration)
* [Black Screen on MacBookPro11,3 in macOS Monterey](#black-screen-on-macbookpro113-in-macos-monterey)
* [No DisplayPort Output on Mac Pros with NVIDIA Kepler](#no-displayport-output-on-mac-pros-with-NVIDIA-kepler)
* [Volume Hash Mismatch Error in macOS Monterey](#volume-hash-mismatch-error-in-macos-monterey)
* [Cannot Disable SIP in recoveryOS](#cannot-disable-sip-in-recoveryos)
* [Stuck on "Less than a minute remaining..."](#stuck-on-less-than-a-minute-remaining)
* [No acceleration after a Metal GPU swap on Mac Pro](#no-acceleration-after-a-metal-gpu-swap-on-mac-pro)
* [Keyboard, Mouse and Trackpad not working in installer or after update](#keyboard-mouse-and-trackpad-not-working-in-installer-or-after-update)
## OpenCore Legacy Patcher not launching
If the application won't launch (e.g. icon will bounce in the Dock), try launching OCLP via Terminal by typing the following command, make sure you've moved the app to `/Applications` before this.
```sh
/Applications/OpenCore-Patcher.app/Contents/MacOS/OpenCore-Patcher
```
## "You don't have permission to save..." error when creating USB installer
In some cases, a following error saying "The bless of the installer disk failed" stating the reason as "You don't have permission to save..." may appear.
<div align="center">
<img src="./images/Error-No-Permission-To-Save.png" alt="NoPermissionToSave" width="400" />
</div>
To resolve this, you may try adding Full Disk Access permission OpenCore Legacy Patcher. To add it, first go to the settings
* Ventura and Sonoma: Go to System Settings -> Privacy and Security -> Full Disk Access
* Big Sur and Monterey: Go to System Preferences -> Security and Privacy -> Full Disk Access
Enable OpenCore-Patcher in the list. If not found on the list, press the + sign to add a new entity and find OpenCore Legacy Patcher from Applications.
Restart OpenCore Legacy Patcher and try creating your USB drive again.
Optional: After you've created your USB drive, you can remove OpenCore Legacy Patcher from Full Disk Access again.
## Stuck on `This version of Mac OS X is not supported on this platform` or (🚫) Prohibited Symbol
This means macOS has detected an SMBIOS it does not support. To resolve this, ensure you're booting OpenCore **before** the macOS installer in the boot picker. Reminder that the option will be called `EFI Boot`.
Once you've booted OpenCore at least once, your hardware should now auto-boot it until either an NVRAM reset occurs, or you remove the drive with OpenCore installed.
However, if the 🚫 Symbol only appears after the boot process has already started (the bootscreen appears/verbose boot starts), it could mean that your USB drive has failed to pass macOS' integrity checks. To resolve this, create a new installer using a different USB drive (preferably of a different model.)
## Cannot boot macOS without the USB
By default, the OpenCore Patcher won't install OpenCore onto the internal drive itself during installs.
After installing macOS, OpenCore Legacy Patcher should automatically prompt you to install OpenCore onto the internal drive. However, if it doesn't show the prompt, you'll need to either [manually transfer](https://dortania.github.io/OpenCore-Post-Install/universal/oc2hdd.html) OpenCore to the internal drive's EFI or Build and Install again and select your internal drive.
Reminder that once this is done, you'll need to select OpenCore in the boot picker again for your hardware to remember this entry and auto boot from then on.
## Infinite Recovery OS Booting
With OpenCore Legacy Patcher, we rely on Apple Secure Boot to ensure OS updates work correctly and reliably with Big Sur. However this installs NVRAM variables that will confuse your Mac if not running with OpenCore. To resolve this, simply uninstall OpenCore and [reset NVRAM](https://support.apple.com/en-mide/HT201255).
* Note: Machines with modified root volumes will also result in an infinite recovery loop until integrity is restored.
## Stuck on boot after root patching
Boot into recovery by pressing space when your disk is selected on the OCLP bootpicker (if you have it hidden, hold ESC while starting up)
* **Note:** If your disk name is something else than "Macintosh HD", make sure to change the path accordingly. You can figure out your disk name by typing `ls /Volumes`.
Go into terminal and first mount the disk by typing
```sh
mount -uw "/Volumes/Macintosh HD"
```
Then revert the snapshot
```sh
bless --mount "/Volumes/Macintosh HD" --bootefi --last-sealed-snapshot
```
Now we're going to clean the /Library/Extensions folder from offending kexts while keeping needed ones.
Run the following and **make sure to type it carefully**
::: warning
If you have **FileVault 2 enabled**, you will need to mount the Data volume first. This can be done in Disk Utility by locating your macOS volume name, selecting its Data volume, and selecting the Mount option in the toolbar.
:::
```sh
cd "/Volumes/Macintosh HD - Data/Library/Extensions" && ls | grep -v "HighPoint*\|SoftRAID*" | xargs rm -rf
```
Then restart and now your system should be restored to the unpatched snapshot and should be able to boot again.
## Reboot when entering Hibernation (`Sleep Wake Failure`)
[Known issue on some models](https://github.com/dortania/Opencore-Legacy-Patcher/issues/72), a temporary fix is to disable Hibernation by executing the following command in the terminal:
```
sudo pmset -a hibernatemode 0
```
## How to Boot Recovery through OpenCore Legacy Patcher
By default, the patcher will try to hide extra boot options such as recovery from the user. To make them appear, simply press the `Spacebar` key while inside OpenCore's Picker to list all boot options.
## Stuck on "Your Mac needs a firmware update"
Full error: "Your Mac needs a firmware update in order to install to this Volume. Please select a Mac OS Extended (Journaled) volume instead."
This error occurs when macOS determines that the current firmware does not have full APFS support. To resolve this, when installing OpenCore, head to "Patcher Settings" and enable "Moderate SMBIOS Patching" or higher. This will ensure that the firmware reported will show support for full APFS capabilities.
## No Brightness Control
With OCLP v0.0.22, we've added support for brightness control on many models. However, some users may have noticed that their brightness keys do not work.
As a work-around, we recommend users try out the below app:
* [Brightness Slider](https://actproductions.net/free-apps/brightness-slider/)
## Cannot connect Wi-Fi on Monterey with legacy cards
With OCLP v0.2.5, we've added support for legacy Wi-Fi on Monterey. However, some users may have noticed that they can't connect to wireless networks.
To work-around this, we recommend that users manually connect using the "Other" option in the Wi-Fi menu bar or manually adding the network in the "Network" preference pane.
## No Graphics Acceleration
In macOS, GPU drivers are often dropped from the OS with each major release of it. With macOS Big Sur, currently, all non-Metal GPUs require additional patches to gain acceleration. In addition, macOS Monterey removed Graphics Drivers for both Intel Ivy Bridge and NVIDIA Kepler graphics processors.
If you're using OCLP v0.4.4, you should have been prompted to install Root Volume patches after the first boot from installation of macOS. If you need to do this manually, you can do so within the patcher app. Once rebooted, acceleration will be re-enabled as well as brightness control for laptops.
## Black Screen on MacBookPro11,3 in macOS Monterey
Due to Apple dropping NVIDIA Kepler support in macOS Monterey, [MacBookPro11,3's GMUX has difficulties switching back to the iGPU to display macOS correctly.](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/522) To work-around this issue, boot the MacBookPro11,3 in Safe Mode and once macOS is installed, run OCLP's Post Install Root Patches to enable GPU Acceleration for the NVIDIA dGPU.
* Safe Mode can be started by holding `Shift` + `Enter` when selecting macOS Monterey in OCLP's Boot Menu.
## No DisplayPort Output on Mac Pros with NVIDIA Kepler
If you're having trouble with DisplayPort output on Mac Pros, try enabling Minimal Spoofing in Settings -> SMBIOS Settings and rebuild/install OpenCore. This will trick macOS drivers into thinking you have a newer MacPro7,1 and resolve the issue.
![](./images/OCLP-GUI-SMBIOS-Minimal.png)
## Volume Hash Mismatch Error in macOS Monterey
A semi-common popup some users face is the "Volume Hash Mismatch" error:
<p align="center">
<img src="./images/Hash-Mismatch.png">
</p>
What this error signifies is that the OS detects that the boot volume's hash does not match what the OS is expecting, this error is generally cosmetic and can be ignored. However if your system starts to crash spontaneously shortly after, you'll want to reinstall macOS fresh without importing any data at first.
* Note that this bug affects native Macs as well and is not due to issues with unsupported Macs: [OSX Daily: “Volume Hash Mismatch” Error in MacOS Monterey](https://osxdaily.com/2021/11/10/volume-hash-mismatch-error-in-macos-monterey/)
Additionally, it can help to disable FeatureUnlock in Settings -> Misc Settings as this tool can be strenuous on systems with weaker memory stability.
## Cannot Disable SIP in recoveryOS
With OCLP, the patcher will always overwrite the current SIP value on boot to ensure that users don't brick an installation after an NVRAM reset. However, for users wanting to disable SIP entirely, this can be done easily.
Head into the GUI, go to Patcher Settings, and toggle the bits you need disabled from SIP:
| SIP Enabled | SIP Lowered (Root Patching) | SIP Disabled |
| :--- | :--- | :--- |
| ![](./images/OCLP-GUI-Settings-SIP-Enabled.png) | ![](./images/OCLP-GUI-Settings-SIP-Root-Patch.png) | ![](./images/OCLP-GUI-Settings-SIP-Disabled.png) |
## Intermediate issues with USB 1.1 and Bluetooth on MacPro3,1 - MacPro5,1
For those experiencing issues with USB 1.1 devices (such as mice, keyboards and bluetooth chipsets), macOS Big Sur and newer have weakened OS-side reliability for the UHCI controller in older Mac Pros.
* UHCI is a USB 1.1 controller that is hooked together with the USB 2.0 ports in your system. Whenever a USB 1.1 device is detected, the UHCI controller is given ownership of the device at a hardware/firmware level.
* EHCI is the USB 2.0 controller in older Mac Pros
Because of this, we recommend placing a USB 2.0/3.0 hub between your devices and the port on the Mac Pro. UHCI and EHCI cannot both be used at once, so using a USB hub will always force the EHCI controller on.
* Alternatively, you can try cold-starting the hardware and see if macOS recognizes the UHCI controller properly.
## Stuck on "Less than a minute remaining..."
A common area for systems to get "stuck", namely for units that are missing the `AES` CPU instruction/older mobile hardware. During this stage, a lot of heavy cryptography is performed, which can make systems appear to be stuck. In reality they are working quite hard to finish up the installation.
Because this step can take a few hours or more depending on drive speeds, be patient at this stage and do not manually power off or reboot your machine as this will break the installation and require you to reinstall. If you think your system has stalled, press the Caps Lock key. If the light turns on, your system is busy and not actually frozen.
## No acceleration after a Metal GPU swap on Mac Pro
If you finished installing Monterey with the original card installed (to see bootpicker for example) and swapped your GPU to a Metal supported one, you may notice that you're missing acceleration. To fix this, open OCLP and revert root patches to get your Metal-supported GPU work again.
Alternatively, you can remove "AutoPkg-Assets.pkg" from /Library/Packages on the USB drive before proceeding with the installation. To see the folder, enable hidden files with `Command` + `Shift` + `.`
The reason for this is that the autopatcher will assume that you will be using the original graphics card and therefore does non-metal patching, which includes removing some drivers for other cards. This causes Metal cards to not accelerate after swapping.
## Keyboard, Mouse and Trackpad not working in installer or after update
For Macs using legacy USB 1.1 controllers, OpenCore Legacy Patcher can only restore support once it has performed root volume patches. Thus to install macOS, you need to hook up a USB hub between your Mac and Keyboard/Mouse.
* For MacBook users, you'll need to find an external keyboard/mouse in addition to the USB hub
More information can be found here:
* [Legacy UHCI/OHCI support in Ventura #1021](https://github.com/dortania/OpenCore-Legacy-Patcher/issues/1021)
Applicable models include:
| Family | Year | Model | Notes |
| :---------- | :--------------------| :---------------------------- | :----------------------------------------------- |
| MacBook | Mid 2010 and older | MacBook5,1 - MacBook7,1 | |
| MacBook Air | Late 2010 and older | MacBookAir2,1 - MacBookAir3,x | |
| MacBook Pro | Mid 2010 and older | MacBookPro4,1 - MacBookPro7,x | Excludes Mid 2010 15" and 17" (MacBookPro6,x) |
| iMac | Late 2009 and older | iMac7,1 - iMac10,x | Excludes Core i5/7 27" late 2009 iMac (iMac11,1) |
| Mac mini | Mid 2011 and older | Macmini3,1 - Macmini5,x | |
| Mac Pro | Mid 2010 and older | MacPro3,1 - MacPro5,1 | |
![](./images/usb11-chart.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

View File

@@ -29,6 +29,7 @@ class os_data(enum.IntEnum):
monterey = 21
ventura = 22
sonoma = 23
sequoia = 24
max_os = 99

View File

@@ -148,7 +148,7 @@ Please check the Github page for more information about this release."""
logging.info("- Detected Snapshot seal intact, detecting patches")
patches = sys_patch_detect.DetectRootPatch(self.constants.computer.real_model, self.constants).detect_patch_set()
if not any(not patch.startswith("Settings") and not patch.startswith("Validation") and patches[patch] is True for patch in patches):
patches = []
patches = {}
if patches:
logging.info("- Detected applicable patches, determining whether possible to patch")
if patches["Validation: Patching Possible"] is False:

View File

@@ -78,7 +78,7 @@ class BuildFrame(wx.Frame):
self.install_button = install_button
# Read-only text box: {empty}
text_box = wx.TextCtrl(frame, value="", pos=(-1, install_button.GetPosition()[1] + install_button.GetSize()[1] + 10), size=(400, 350), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
text_box = wx.TextCtrl(frame, value="", pos=(-1, install_button.GetPosition()[1] + install_button.GetSize()[1] + 10), size=(380, 350), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
text_box.Centre(wx.HORIZONTAL)
self.text_box = text_box

View File

@@ -252,7 +252,7 @@ class InstallOCFrame(wx.Frame):
text_label.Centre(wx.HORIZONTAL)
# Read-only text box: {empty}
text_box = wx.TextCtrl(dialog, value="", pos=(-1, text_label.GetPosition()[1] + text_label.GetSize()[1] + 10), size=(370, 200), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
text_box = wx.TextCtrl(dialog, value="", pos=(-1, text_label.GetPosition()[1] + text_label.GetSize()[1] + 10), size=(350, 200), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
text_box.Centre(wx.HORIZONTAL)
self.text_box = text_box

View File

@@ -111,7 +111,7 @@ class SysPatchDisplayFrame(wx.Frame):
if not any(not patch.startswith("Settings") and not patch.startswith("Validation") and patches[patch] is True for patch in patches):
logging.info("No applicable patches available")
patches = []
patches = {}
# Check if OCLP has already applied the same patches
no_new_patches = not self._check_if_new_patches_needed(patches) if patches else False

View File

@@ -198,7 +198,7 @@ class SysPatchStartFrame(wx.Frame):
# Text box
text_box = wx.TextCtrl(dialog, pos=(10, patch_label.GetPosition()[1] + 30), size=(400, 400), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
text_box = wx.TextCtrl(dialog, pos=(10, patch_label.GetPosition()[1] + 30), size=(380, 400), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
text_box.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL))
text_box.Centre(wx.HORIZONTAL)
self.text_box = text_box

View File

@@ -3,7 +3,9 @@
<plist version="1.0">
<dict>
<key>AssociatedBundleIdentifiers</key>
<string>com.dortania.opencore-legacy-patcher</string>
<array>
<string>com.dortania.opencore-legacy-patcher</string>
</array>
<key>Label</key>
<string>com.dortania.opencore-legacy-patcher.auto-patch</string>
<key>ProgramArguments</key>

View File

@@ -3,7 +3,9 @@
<plist version="1.0">
<dict>
<key>AssociatedBundleIdentifiers</key>
<string>com.dortania.opencore-legacy-patcher</string>
<array>
<string>com.dortania.opencore-legacy-patcher</string>
</array>
<key>Label</key>
<string>com.dortania.opencore-legacy-patcher.macos-update</string>
<key>ProgramArguments</key>

View File

@@ -3,7 +3,9 @@
<plist version="1.0">
<dict>
<key>AssociatedBundleIdentifiers</key>
<string>com.dortania.opencore-legacy-patcher</string>
<array>
<string>com.dortania.opencore-legacy-patcher</string>
</array>
<key>Label</key>
<string>com.dortania.opencore-legacy-patcher.rsr-monitor</string>
<key>ProgramArguments</key>

View File

@@ -3,7 +3,9 @@
<plist version="1.0">
<dict>
<key>AssociatedBundleIdentifiers</key>
<string>com.dortania.opencore-legacy-patcher</string>
<array>
<string>com.dortania.opencore-legacy-patcher</string>
</array>
<key>Label</key>
<string>com.dortania.opencore-legacy-patcher.rsr-monitor</string>
<key>ProgramArguments</key>