0

I want to run the following shell command in Objective-C

sshfs -C -p 22 user@remote.computer.com ~/local/directory/path

using the command system("sshfs -C -p 22 user@remote.computer.com ~/local/directory/path");

but I get sh: sshfs: command not found in NSLog.

If I copy and paste it into terminal however, it works.

codenamepenryn
  • 451
  • 1
  • 7
  • 18

1 Answers1

2

The path used by an GUI application does not include any changes you have made in your shell files in your home directory (e.g. ~/.bashrc)

One way is to use the full path in the system call. (i.e. /Users/username/Projects - ~ are not automatically expanded) In a Cocoa app I would use NSTask to give more control

mmmmmm
  • 32,227
  • 27
  • 88
  • 117