I need to run *.app from our NFS share where the different apps and versions are stored.

I can't get it to work as part of a bash script.

For exemple, for Sublime Text, here is the command I use to launch:

elif [ `uname` == "Darwin" ]; then
    exec open -a "/path/to/nfs/"Sublime\ Text.app" "$@"

When I call my script, I get the following error:

FSPathMakeRef(/path/to/nfs/Sublime Text.app) failed with error -43.

I know the path is right. Permissions are also fine. I'm able to launch it with the full path exec open -a "/path/to/nfs/"Sublime\ Text.app/Contents/MacOS/"Sublime\ Text"" "$@" but then all the content of the .app folder isn't available.

Is there another way to launch .app from command line?

  • 1
    -43 == file not found. foo.app should be in /path/to/nfs/foo/Contents/MacOS/foo.app though idk if it will work from an nfs.
    – Tetsujin
    Feb 19, 2018 at 17:04
  • 1
    Why are you using exec? What's the purpose of "$@"? What happens if you just use: open -a "/path/to/nfs/Sublime Text.app" It works for me. BTW Don't escape spaces with a backslash and quotes, use one or the other, not both. Feb 19, 2018 at 17:10
  • 1
    I can indeed remove the exec command. For the "$@", it allows me to pass argument when my command is part of a script: "my_script /path/to/file/" Feb 19, 2018 at 17:39
  • 1
    @user3439894, your command indeed works when launched from a terminal but not when being part of a script. Feb 19, 2018 at 17:45
  • 1
    First of all, my command as written does indeed work from a bash script, to open Sublime Text! Secondly, you never mention in your OP that this was part of a script and why I questioned what "$@" was for. BTW I know what "$@" is for as I've read the bash man page more then once, but in the context of your OP it made no sense because you didn't say your were executing it in script! Obviously in a script that you want to pass arguments to my command, it would be open -a "/Volumes/Data/Temp/Sublime Text.app" "$@" and it works! Feb 19, 2018 at 18:31

1 Answer 1


The primary issue I see with your command:

exec open -a "/path/to/nfs/"Sublime\ Text.app" "$@"

Is you have used a backslash to escape a space while also quoting the command. Use one or the other, but not both, e.g.:

open -a "/path/to/nfs/Sublime Text.app"


open -a /path/to/nfs/Sublime\ Text.app

I also see no reason to use exec when the open command by itself works in this context, or from a script, e.g.:

open -a "/path/to/nfs/"Sublime Text.app" "$@"

That said though, when using the open command with the -a option you might consider using the --args option, which from its man page states, "All remaining arguments are passed to the opened application in the argv parameter to main(). These arguments are not opened or interpreted by the open tool.", thus making the command as, e.g.:

open -a "/path/to/nfs/"Sublime Text.app" --args "$@"

You must log in to answer this question.

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