Add login item from command line
Found the following Can Login Items be added via the command line in High Sierra?
which I'm trying to adapt to add a login item in 10.14.6
I realize that it's a somewhat old thread by now, but I've been trying with the following, in 10.14.6, adapted from the solved in thread linked above:
osascript -e 'tell application "System Events" to make login item at end with properties {path:"/Applications/cDock.app/Contents/Resources/cDock\ Helper.app", hidden:false}'
But keep getting the following error:
syntax error: Expected “"” but found unknown token. (-2741)
Can someone perhaps suggest how to rewrite this to avoid the error?
Solution 1:
You need to remove the backslash (\
) from: cDock\ Helper.app
You do not need to escape spaces in a path filename when it is in quotes.
Only escape spaces in a path filename when it is not in quotes.
Never do both, (in this use case).