3

I try to call an application from the console and pass it an argument. This is the script I am using:

#!/bin/sh

open -a "/Applications/MyApp.app/" $1

Somehow the OS is unhappy with this and complains:

FSPathMakeRef(/Applications/MyApp.app) failed with error -43.

What can I do?

3
  • 1
    That looks like /Applications/MyApp.app doesn't actually exist. You sure it's there?
    – Mark Reed
    Sep 13, 2014 at 2:39
  • Thanks! That was silly. Sorry for asking, but at least I now know what error 43 means ... Sep 13, 2014 at 15:32
  • Mac OS error -43 (fnfErr): File not found
    – njboot
    Sep 13, 2014 at 20:39

2 Answers 2

4

That looks like /Applications/MyApp.app doesn't actually exist.

You can test for that in your script, perhaps like this:

#!/bin/sh
APP=/Applications/MyApp.app
if [ ! -d "$APP" ]; then
  echo >&2 "$0: $APP not found."
  exit 1
fi
exec open -a "$APP" "$@"
4

You can make sure the application exists before calling open on it! Here's a quick bit of Bash to do this:

if [ -d "/Applications/MyApp.app" ]; then
    open -a "/Applications/MyApp.app"
else
    echo "Application /Applications/MyApp.app does not exist!"
fi

You must log in to answer this question.

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