Adding hidden Login Items on macOS Ventura
One of the changes made between macOS Monterey’s System Preferences and macOS Ventura’s System Settings is that the Hide checkbox in System Preferences’ Login Items has disappeared from System Settings’ Login Items.
Login Items in System Preferences
Login Items in System Settings
Fortunately for those who want to continue being able to launch applications on login and automatically hide them, it’s still possible to do so on macOS Ventura from the command line using osascript.
To do this, run a command similar to the one shown below using the logged-in user’s privileges:
/usr/bin/osascript -e 'tell application "System Events" to make login item at end with properties {path:"/path/to/itemname", hidden:true}'
For example, if you want Safari to launch at login with its windows automatically hidden, run the command below using the logged-in user’s privileges:
/usr/bin/osascript -e 'tell application "System Events" to make login item at end with properties {path:"/Applications/Safari.app", hidden:true}'
Safari will appear in the Login Items list without any sign that it’s launching as hidden, but the application behavior on login will be just like it would be on earlier versions of macOS where the Hide checkbox was checked.
What about if my cellphone is hacked with “Pegasus”!!!
It’s missing two things: trailing single quote at the end of the command, and Ventura 13.0.1, you need to append the name of the login item if you don’t want a “login item UNKNOWN” error.
How to append the name of the login item?
As a final property in the dictionary:
❯ /usr/bin/osascript -e ‘tell application “System Events” to make login item at end with properties {path:”/Applications/Safari.ap”, hidden:true, name:”Safari”}’
I did this with Activity Monitor. It did not launch it “hidden”… It merely minimized it.
Your example commands are missing the final end single-quote ‘