Skip to main content
Solved

posix_spawn no such file or directory - launchctl as user

  • October 11, 2023
  • 1 reply
  • 3 views

Forum|alt.badge.img+3

My Google-foo is failing me.  Although my script works to trigger the Jamf helper window - I get 'posix_spawn(): 2: No such file or directory' <-- And as far as I can tell it's because i'm trying to call launchctl -but - can't figure it out.  Is this an error I should be concerned about?

JHELPER="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper" LOGGED_IN_USER=$(stat -f%Su /dev/console) LOGGED_IN_UID=$(id -u "$LOGGED_IN_USER") echo $LOGGED_IN_USER WELCOME=$("$JHELPER" -windowType utility -windowPosition lr -heading "Urgent message from Mac Desktop Services." -alignDescription natural -description "An urgent OS update is needed on your system. Please run sofware update at the end of the day (Apple Menu --> System Settings --> General - Software Update) and install Ventura macOS 13 updates to bring your system to 13.6 if it is not already. Please do not click Upgrade to Sonoma, only updates for macOS 13 Ventura " -button1 "Go to updates" -button2 "Dismiss" -cancelButton "2") if [ "$WELCOME" == "0" ]; then /bin/launchctl asuser "$LOGGED_IN_UID" "$LOGGED_IN_USER" osascript -e 'do shell script "open x-apple.systempreferences:com.apple.Software-Update-Settings.extension"' echo "Clicked to update" exit 0 else echo "user chose dismiss" exit 1 fi

 

 

 

Best answer by sdagley

@ChuckFinley No need to try calling as an osascript, just do the open:

 

open 'x-apple.systempreferences:com.apple.Software-Update-Settings.extension'

You might also want to look at this article on running a command as another user for best practices on that: https://scriptingosx.com/2020/08/running-a-command-as-another-user/

 

View original
Did this topic help you find an answer to your question?

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • October 11, 2023

@ChuckFinley No need to try calling as an osascript, just do the open:

 

open 'x-apple.systempreferences:com.apple.Software-Update-Settings.extension'

You might also want to look at this article on running a command as another user for best practices on that: https://scriptingosx.com/2020/08/running-a-command-as-another-user/

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings