MacOS cli program permission denied

Hi all. I'm currently experiencing a problem where I'm testing the HelloPhotogrametry command line app released by Apple. I keep on getting the zsh: permission denied notice. I chmod 777 everything in the folder but the issue still persists.

richardmac@RichardMacdeMacBook-Pro CreatingAPhotogrammetryCommandLineApp % ./HelloPhotogrammetry ./Aug\ 15,\ 2022\ at\ 8:52:59\ PM ./newfolder -d full -o sequential -f normal
zsh: permission denied: ./HelloPhotogrammetry

I typed ls -l, and all the files have rwx capabilities.

total 8
drwxrwxrwx@ 20 richardmac  staff  640  8 15 20:54 Aug 15, 2022 at 8:52:59 PM
drwxrwxrwx@  3 richardmac  staff   96 11  3  2021 Configuration
drwxrwxrwx@  6 richardmac  staff  192 11  3  2021 Data
drwxrwxrwx@  4 richardmac  staff  128  8 16 10:15 HelloPhotogrammetry
drwxrwxrwx@  6 richardmac  staff  192  8 16 09:22 HelloPhotogrammetry.xcodeproj
drwxrwxrwx@  4 richardmac  staff  128 11  3  2021 LICENSE
-rwxrwxrwx@  1 richardmac  staff  282 11  3  2021 README.md
drwxrwxrwx   2 richardmac  staff   64  8 15 21:41 newfolder

I checked the documents folder, it has rwx capabilities as well.

total 0
drwx------+  6 richardmac  staff   192  8 15 14:25 Desktop
drwxrwxrwx+  7 richardmac  staff   224  8 15 21:41 Documents
drwx------+ 31 richardmac  staff   992  8 15 21:25 Downloads
drwx------@ 86 richardmac  staff  2752  8 15 15:35 Library
drwx------   6 richardmac  staff   192  8 13 03:22 Movies
drwx------+  5 richardmac  staff   160  8 13 17:45 Music
drwx------+  5 richardmac  staff   160  8 13 17:45 Pictures
drwxr-xr-x+  4 richardmac  staff   128  8 12 20:42 Public
-rw-r--r--   1 richardmac  staff     0  8 13 02:04 brew_install

total 32
drwxrwxrwx@ 13 richardmac  staff    416  8 16 10:15 CreatingAPhotogrammetryCommandLineApp
drwxr-xr-x@ 10 richardmac  staff    320  8 15 10:25 GitHub

The program folder is located at /Users/richardmac/documents/CreatingAPhotogrammetryCommandLineApp Any help is greatly appreciated.

Answered by DTS Engineer in 724432022

Yes I did build the project in Xcode.

Cool.

When you build the tool in Xcode, it doesn’t place the executable on your path. Rather, the build results, including the built executable, ends up in ~/quinn/Library/Developer/Xcode/DerivedData/HelloPhotogrammetry-JJJ/Build/Products/Debug/HelloPhotogrammetry, where JJJ is some seemingly random string. If you just want to use the tool from Terminal, do this:

  1. Build it in Xcode.

  2. Choose Product > Show Build Folder in Finder.

  3. In the resulting Finder window, navigate to Products > Debug.

  4. Copy the HelloPhotogrammetry executable to somewhere convenient. For example, I have a ~/bin directory in my path, so I would copy the executable there.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

It looks like you’re trying to execute the HelloPhotogrammetry directory, which suggests that you’ve misunderstood how this setup works. What you’ve downloaded here is sample code; it doesn’t include a pre-built binary. To get this, you must build the tool with Xcode.

So, try this:

  1. Open HelloPhotogrammetry.xcodeproj.

  2. Navigate to Signing & Capabilities for the HelloPhotogrammetry target and select your development team in the Team popup.

  3. Choose Product > Build.

  4. Choose Product > Run. The tool should run and print its usage.

Are you able to get that working?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"


Error: Missing expected argument '<input-folder>'

OVERVIEW: Reconstructs 3D USDZ model from a folder of images.

USAGE: hello-photogrammetry <input-folder> <output-filename> [--detail <detail>] [--sample-ordering <sample-ordering>] [--feature-sensitivity <feature-sensitivity>]

ARGUMENTS:
 <input-folder>     The local input file folder of images.
 <output-filename>    Full path to the USDZ output file.

OPTIONS:
 -d, --detail <detail>  detail {preview, reduced, medium, full, raw} Detail
             of output model in terms of mesh size and texture
             size . (default: nil)
 -o, --sample-ordering <sample-ordering>
             sampleOrdering {unordered, sequential} Setting to
             sequential may speed up computation if images are
             captured in a spatially sequential pattern.
 -f, --feature-sensitivity <feature-sensitivity>
             featureSensitivity {normal, high} Set to high if the
             scanned object does not contain a lot of discernible
             structures, edges or textures.
 -h, --help       Show help information.

Program ended with exit code: 64



The point is that the command line app is supposed to be used by typing the arguments in the command prompt. The "./HelloPhotogrammetry" is the way to initiate the application because the main.swift is inside the directory. And the rest of the arguments follow suits.

Here is an example:

./HelloPhotogrammetry ./Wooden_bike_photos ./Wooden_bike_model -d full -o sequential -f normal

The ./HelloPhotogrammetry is used as the command, just like the ls command or ipconfig command. And the rest of the stuff are the arguments, just like the -l in ls -l.

I have found a pretty stupid and dumb way to work around if I absolutely want the output so bad. In Xcode, I click Product in the menu bar, select scheme -> edit scheme .

To use this method I have to put the input folder and the output folder in the debug folder corresponding to the project. And every time I need to use the app I will have to make manual input in the scheme to pass the arguments to the app. This way it works but this is obviously never meant to be the normal way to use a cli app. A command-line application is meant to be used just like the way we use brew . There is absolutely no way that a user needs to build the app in Xcode every time he uses it.

I don't necessarily need the 3d model right now. I just want to know why I can't use it. Like, I have all the permissions. I checked in and out, day and night, I chmod 777 everything from top to bottom, every file every folder and every subfolder. It should works as intended but it doesn't. No matter how many times I double-checked the rwx capabilities in ls -l , I always get yelled zsh: permission denied: ./HelloPhotogrammetry. Like why? Why does it behave like this? I have all the permissions, why can't I use it???

Accepted Answer

Yes I did build the project in Xcode.

Cool.

When you build the tool in Xcode, it doesn’t place the executable on your path. Rather, the build results, including the built executable, ends up in ~/quinn/Library/Developer/Xcode/DerivedData/HelloPhotogrammetry-JJJ/Build/Products/Debug/HelloPhotogrammetry, where JJJ is some seemingly random string. If you just want to use the tool from Terminal, do this:

  1. Build it in Xcode.

  2. Choose Product > Show Build Folder in Finder.

  3. In the resulting Finder window, navigate to Products > Debug.

  4. Copy the HelloPhotogrammetry executable to somewhere convenient. For example, I have a ~/bin directory in my path, so I would copy the executable there.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

MacOS cli program permission denied
 
 
Q