Copy pasted from my other posts, just use one of these. You literally just copy below the bold, paste it in Terminal, and hit the enter key. The order doesn’t matter. Also a heads up, a choose dialog will pop up... The purpose is to tell the code what to fix by you selecting the application to work on (the one that fails to run). This means it’s going to be the first thing you do in order to figure out what’s wrong with the application (preparations), but because we know what's wrong with it (the jre), either order would work
- DL via link and the remaining steps that takes care of replacing the jre
- Run one of the two code below
The long version (walk you through some things):
clear; printf "\nYou only need to run this just once. If the app launches correctly, you can just double click / launch the app now\n\nThis will give executables within the app directory the execution permission via chmod command. Afterwards this will remove the extended attribute com.apple.quarantine from a new app that keeps it from opening automatically (prevents you from opening it)\n\nIf the app doesn't launch, you can check inside an application by right clicking it > Show Package Contents, open Contents, open MacOS, drag the executable file into a Terminal window, and hit enter. If there are multiple files go back to the Contents directory (you can use Command + Up Arrow and Command + Down Arrow to go up and down directories), select Info.plist, remind yourself the string value after CFBundleExecutable, then use the spacebar on the selected item to toggle Quicklook. The string value after CFBundleExecutable is the name of the file inside the MacOS folder you want to drag into a Terminal window and enter. Running the executable under Terminal can output information when the app fails to run correctly\n\nHit the enter / return key when ready"; read; printf "\nSelect the application that cannot open\n\n"; a="$(osascript -e 'POSIX path of (choose file default location (path to downloads folder) of type "APPL" with prompt "Select the application that cannot open")')"; if [[ $? -eq 0 ]]; then printf "(Re)Applying the execution permission to executable files..."; while read f; do if [[ "$(file -b "$f")" =~ "Mach-O 64-bit executable x86_64" ]]; then chmod +x "$f"; fi; done < <(find "$a"); if [[ $? -eq 0 ]]; then printf "done\n"; printf "\nRemoving extended attribute com.apple.quarantine from app..."; if [[ "$(xattr "$a")" =~ "com.apple.quarantine" ]]; then xattr -r -d com.apple.quarantine "$a"; printf "done\n"; else printf "already removed\n"; fi; printf "\nPlease wait until application launches..."; open "$a"; printf "done\n"; fi; fi; printf "\n"
The short version (just run but without the helpful info):
printf "\nSelect the application that cannot open\n\n"; a="$(osascript -e 'POSIX path of (choose file default location (path to downloads folder) of type "APPL" with prompt "Select the application that cannot open")')"; if [[ $? -eq 0 ]]; then printf "(Re)Applying the execution permission to executable files..."; while read f; do if [[ "$(file -b "$f")" =~ "Mach-O 64-bit executable x86_64" ]]; then chmod +x "$f"; fi; done < <(find "$a"); if [[ $? -eq 0 ]]; then printf "done\n"; printf "\nRemoving extended attribute com.apple.quarantine from app..."; if [[ "$(xattr "$a")" =~ "com.apple.quarantine" ]]; then xattr -r -d com.apple.quarantine "$a"; printf "done\n"; else printf "already removed\n"; fi; printf "\nPlease wait until application launches..."; open "$a"; printf "done\n"; fi; fi; printf "\n"