OSX 10.11 incorrectly sees application as powerPC I have built and successfully run an application on OSX 10.11. Then I decided to create a bundle for the app and launched it successfully.  Then I moved the bundle to the Applications folder and it did not start anymore displaying the popup:


  'You can’t open the application “CodeBlocks” because PowerPC applications are no longer supported'


Obviously this isn't a PowerPC application.  Renaming the app, copying it to other locations restarting the mac did not solve the issue.

I'm using: 


  MacBook Air (13-inch Mid 2011), OS X El Capitan (10.11.3)


How can I prevent this error from being thrown?
I reproduced this error on OS X El Capitan version 10.11.6 and found a workaround:

Error:


  You can't open the application "Open_todo_in_vim" because PowerPC applications are no longer supported


Picture:


How to Reproduce the error:

Full reproduction instructions found here:
https://mathiasbynens.be/notes/shell-script-mac-apps

Jist:

Save this as appify.sh

#!/usr/bin/env bash

APPNAME=${2:-$(basename "${1}" '.sh')};
DIR="${APPNAME}.app/Contents/MacOS";

if [ -a "${APPNAME}.app" ]; then
    echo "${PWD}/${APPNAME}.app already exists :(";
    exit 1;
fi;

mkdir -p "${DIR}";
cp "${1}" "${DIR}/${APPNAME}";
chmod +x "${DIR}/${APPNAME}";

echo "${PWD}/$APPNAME.app";


Save it as /usr/local/bin/appify.sh, which requires root privileges give it executable permissions and then run it like so:

$ appify your-shell-script.sh "Your App Name"


Double click on "Your App Name".  

Observe the error shown above.

Why is this annoying error happening?

It's a combination of many reasons:


Safety: The developers over at Apple are fighting cybercrime with scripts in the background replacing your docked items.  Roadblocks make successful viruses of yesteryear hit a brick wall.  This is one of those walls.
Money: The developers over at Apple want you to use their applications, not the applications you found over the internet because every app you use is a potential attack vector from unscrupulous developers worldwide.
Protecting users from themselves: Apple developers only want power users to created docked items, you don't want novices figuring out "Hey!  Anyone can drag some_low_level_guts_script.sh to the OSX dock and it solves my problem!  Apple prevents this for the same reason parents keep bleach under the sink behind locked doors when toddlers are around.  


Hacky Workaround so you can run your script without the PowerPC application error:

I found the answer that explains how to execute Shell Scripts from the OS X Dock here: https://stackoverflow.com/a/21048589/445131

Jist of Hacky workaround


Create your shell script whatever.sh
Make your shell script executable.
Rename your whatever.sh to have a .app suffix: whatever.sh.app
Drag whatever.sh.app to the OSX dock.
Rename your script back to whatever.sh.
Right-click the file in Finder, and click the "Get Info" option.
At the bottom of the window, set the shell script to open with the terminal.


And the error mentioned at top no longer occurs.  Double clicking the file on the OSX dock runs the shell script as expected without error.