Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

same problem

(13 edits)

Because how common it is to run into new Mac application issues, I made this as a helper script you can copy, launch the Terminal application (you can spotlight search it or browse to /Application/Utilities), paste within Terminal, and hit the enter / return key to execute

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"

holy shit it works, thanks man, you're a hero.

Thank you for your effort put into this.

(1 edit)

I'm probably going to continue to edit it (in case you copied it to a text file or something) for instance I changed the "$(file -b /path/to/something)" part to see if the output contains "Mach-O 64-bit executable x86_64" rather than exactly "Mach-O 64-bit executable x86_64" in case of an executable being universal (this means so the chmod part runs in order to set the execute permission on the executable)

So do I just have to copy and paste then execute?  Im new to Mac so what do copy and paste into the terminal?

Never mind I figured it out. Thanks for the help bro I wish only the good fortune upon you.

(1 edit)

first of all i want to thank you for doing this for the community, but is there a tutorial video or something to run this? i really tried to understand but its very hard for me

Edit: i found a video that helped me fix it https://www.youtube.com/watch?v=6fqzb4qpgcs&ab_channel=Hutch

You can activate otherwise deactivate spotlight by holding the Command key and hitting the spacebar (space key). Alternatively you can click the magnifying glass in the menu bar (the bar at the top edge of your screen). With it active, typing letter by letter "terminal" you can hit the return key when your search "Terminal" is selected or double click the one not selected. You can click the launchpad item in your dock (the tray full of apps at the bottom of your screen) and type letter by letter "terminal" and click on it. In Finder you can do Command + Shift + U to show the Utilities folder which is where the Terminal app is and double click on it (in the menu bar at the very top click the item "Go" to see the other shortcuts). Having a Finder window open you can click on the sidebar item on the left called "Applications", then scroll to Utilities, double click it, and then Terminal. Really all you need to run this app is to delete the extended attribute "com.apple.quarantine" from the app

xattr -d com.apple.quarantine <after the space drag app in the Terminal window then return key>

Though he made it a bit simpler just using the c flag to clear all extended attributes instead of specifying an extended attribute to delete, but used the r flag to apply that recursively (everything inside the app directory as well). Sometimes you may need these options to save some time but personally I wouldn't use "-cr" together unless you need to

The problem, however, is with how many of these executables coming off of Windows machines that doesn't know anything about Unix permissions, so you often have to apply it yourself with the Terminal command

chmod +x /path/to/executable

Where the executable for Mac lives inside the *.app/Contents/MacOS/ folder. If you right click a Mac application, you can go inside it (it's actually just a directory / folder) by selecting "Show Package Contents". When you double click / open a Mac application you are executing that executable file (*.app/Contents/MacOS/executable). Without the execute permission to that executable, Finder will just say "Application can't be opened" and Terminal will say "Permission denied" when you run it within Terminal (how can you can execute something if there is no permission to execute it?). You can execute executables in Terminal just by specifying the path to it, and hit the return key. The benefit about doing it within Terminal is to display information on why it failed