Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [BUG] Installed apps not found when running commands from Shortcuts app #532

Closed
1 task done
LouisRoselli opened this issue Aug 13, 2024 · 2 comments
Closed
1 task done
Labels

Comments

@LouisRoselli
Copy link

Your Environment

  • mas version: 1.8.6
  • macOS version (system_profiler SPSoftwareDataType -detailLevel mini): 10.1...
Software:

    System Software Overview:

      System Version: macOS 14.6.1 (23G93)
      Kernel Version: Darwin 23.6.0
      Time since boot: 5 days, 4 hours, 19 minutes

mas Install Method

  • brew install mas (homebrew-core)
  • [] mas-cli/tap
  • [] .pkg installer from releases
  • [] Built from source
    • Fork/branch: ? (e.g. mas-cli/main)
    • Xcode version: 10.?

Describe the Bug

Running "mas" commands in Shortcuts app's "Run Shell Script" action is not detecting any installed apps on the system when running these commands:

Command Results
mas list "No installed apps found"
mas outdated BLANK
mas upgrade "Warning: Nothing found to upgrade"
  • The Shortcuts app is running the script as Administrator and has permissions for Full Disk Access. (See screenshots attached)
  • All commands work as expected and perfectly fine from Terminal. (See screenshots attached)

To Reproduce

You can use this link to get a copy of the shortcut instead of manually creating one: https://www.icloud.com/shortcuts/25b3da7ce04b467bb75dc83dbd4b631c

Steps to reproduce the behavior:

  1. Go to Shortcuts app.
  2. Click on '+' at the top of the app to create a new shortcut.
  3. In the shortcut, add an action called "Run Shell Script"
  4. Set the following:
    1.  PATH=$PATH:/opt/homebrew/bin
       mas list
    2. Shell: "zsh"
    3. Input: "Input"
    4. Pass Input: "to stdin"
    5. Run as Administrator: checked
  5. Add an action called "Show Result" after the previous action and set the "Shell Script Result" as the output.
  6. Repeat Steps 3-5 for commands "mas outdated" and "mas upgrade".

Expected Behavior

I expected a list of apps to show like the results from Terminal.
I expected a list of outdated apps to show like the results from Terminal.
I expected outdated apps to upgrade and show like the results from Terminal.

Actual Behavior

Got an output of "No installed apps found".
Got an output of "".
Got an output of "Warning: Nothing found to upgrade".

Screenshots, Terminal Output

mas-shortcuts-issue-1 mas-shortcuts-issue-2 mas-shortcuts-issue-3 mas-shortcuts-issue-4 mas-shortcuts-issue-5
@rgoldberg
Copy link
Contributor

Uncheck Run as Administrator.

sudo mas list, not mas list, is the same as Run as Administrator.

e.g.:

$ sudo mas list
Password:
Error: No installed apps found

$ mas list
497799835   Xcode                     (14.2)
…

@LouisRoselli
Copy link
Author

AND I'm dumb lol! Unchecking the "Run as administrator" fixed it. I think I originallly had it checked because of the full disk access permissions being weird.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants