10

I tried following a few tutorials, but I get this: PowerPC Error

How can I fix this? I added in a info.plist (I just copied and pasted another app's file, and changed around a few things.)

Also, I used chmod +x myApp to make the script executable.

P.S. I am using El Capitan

  • We can't guess what you did before getting the error message. Which tutorials did you follow, after which step did you get stuck? – nohillside Jan 21 '16 at 21:18
  • 1
    I created a folder called myApp.app, then a sub folder called Contents, then MacOS, then a myApp shell script that contains #!/bin/bash ; say "Hi" ; exit 0 (With each of the commands on different lines, and w/o the semicolon). – Flare Cat Jan 21 '16 at 21:26
  • 1
    A bash script that has it execute bit set doesn't necessarily need to be placed in a bundle to be executed, simple double-click it if just in Finder or run it from Terminal. If you really want an application bundle then create it using AppleScript or Automator, the latter of which is easy. Add a Run Shell Script action and place your code in it. – user3439894 Jan 22 '16 at 11:54
  • @user3439894 I tried automater in the method you described before posting this, but the app would not run on the target computer. – Flare Cat Jan 22 '16 at 20:04
  • @user3439894 Well, for some reason I can't edit my previous comment. The error was something like 'This type of application is not supported on this computer.' – Flare Cat Jan 22 '16 at 20:24
19

Well, it's been years I use this simple trick to have bash scripts in application (and really really don't understand why all people try so complicated solutions as creating "Contents" folders, info.plist or use Automator or Platypus or so... ????) : Create a folder named "YourApplication.app". Put your bash script file directly in this folder the way that suites you the best (Finder, terminal etc). The bash script must be executable of course (use chmod +x if you need). No need for other folders or file (until you need to call other scripts or executable from within your script of course) The trick is to name your script with exactly the same name as the application folder but without extension. In the case described here the script file must be named "YourApplication". That's all ! It works on Mac os x since Snow Leopard to Mavericks. If anybody can try on newer OS versions and tell me.

Note: The script must be at least 28 bytes in size, otherwise it will not execute. It may be padded with blank lines to achieve minimum size. Also, the first line of the script must be a shebang; e.g. #!/bin/bash or #!/bin/perl.

  • Try to add some more lines, it gives you the message you had if there is not enough lines in your script. – Pierre Lagarde Jan 16 '17 at 16:08
  • I've edited your answer to include the critical missing piece of information and up-voted it. – user3439894 Jan 16 '17 at 16:14
  • OK thanks for correction and upvoting... I've been using this since too long time and forgot about the need for 28 bytes... I don't have any script that small of course :D – Pierre Lagarde Jan 16 '17 at 16:18
  • 1
    I just tested this under macOS Sierra and it works there too. – user3439894 Jan 16 '17 at 16:19
  • 1
    @FlareCat In fact, I just checked and I guess any shebang with an existing interpreter will do (tried with perl). If you tried other languages, just tell ;). – Pierre Lagarde Feb 11 '17 at 16:24
5

If it is a simple shell script, then you don't need to wrap it in an application bundle; you can double-click the script itself. However, you won't get the ability to have a custom icon or other things like that.

I think there are a few helpers out there that can wrap simple scripts, but the only one that I have experience with is Platypus which allows you to make shell/python/perl/ruby/etc scripts run like regular applications with icons, I/O redirections, etc.

  • Platypus looks good, but it would be great to know how to do it manually. – Flare Cat Jan 22 '16 at 20:10
  • 1
    Tested out Platypus, works exactly how I wanted! Thanks for the suggestion. – Flare Cat Jan 23 '16 at 1:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .