Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

CharlieJames91

macrumors newbie
Original poster
Jun 3, 2016
16
1
Hi.

Is there an easy terminal command to place applications in the users login items specifically for 10.10/10.11

I did have a post on this yesterday but it was mis-understood, all I need to know ia if there is an easy terminal command to place apps in the login items.

I'm not great with isoscripting etc so was hoping there is an easy 1 line command to do this.

Thanks
 
  • Like
Reactions: darrylsvochak

chown33

Moderator
Staff member
Aug 9, 2009
10,898
8,712
A sea of green
See here:
https://gist.github.com/kaloprominat/6111584

The command lines given there are shell commands. The 'osascript' command runs AppleScript scripts. The best way I know of to access login items is via AppleScript.

To change the examples, you'll need to know the Posix pathname of the application.

I don't understand what you mean by "isoscripting". Maybe you meant something about the 'osascript' command. Accuracy is important in programming.

EDIT:
Sorry, the URL didn't paste correctly the first time. Updated with link.
 
Last edited:
  • Like
Reactions: CharlieJames91

CharlieJames91

macrumors newbie
Original poster
Jun 3, 2016
16
1
See here:
https://gist.github.com/kaloprominat/6111584

The command lines given there are shell commands. The 'osascript' command runs AppleScript scripts. The best way I know of to access login items is via AppleScript.

To change the examples, you'll need to know the Posix pathname of the application.

I don't understand what you mean by "isoscripting". Maybe you meant something about the 'osascript' command. Accuracy is important in programming.

EDIT:
Sorry, the URL didn't paste correctly the first time. Updated with link.


Thank you. I have tried the above link but not entirely sure if I am doing something incorrectly - see bellow:

osascript -e 'tell application "System Events" to make login item at end with properties {name: "Microsoft Lync",path:"/Applications/Microsoft Lync.app", hidden:false}'

36:153: execution error: System Events got an error: AppleEvent timed out. (-1712)


I was rushing on my mobile device when I created this thread but I agree, I should have defined this more accurately. I am a beginner - and hopefully, will not be making these mistakes for much longer.

Thank you
 

chown33

Moderator
Staff member
Aug 9, 2009
10,898
8,712
A sea of green
Thank you. I have tried the above link but not entirely sure if I am doing something incorrectly - see bellow:

osascript -e 'tell application "System Events" to make login item at end with properties {name: "Microsoft Lync",path:"/Applications/Microsoft Lync.app", hidden:false}'

36:153: execution error: System Events got an error: AppleEvent timed out. (-1712)
First, read about using CODE tags in posts:
https://forums.macrumors.com/threads/posting-code-please-use-the-code-tags.747660/


Test #1:

Paste the following commands into Terminal. Post the complete output in CODE tags.
Code:
osascript -e 'tell application "System Events" to get count of login items'

osascript -e 'tell application "System Events" to get the name of every login item'


Test #2:

Paste the following command into Terminal. Post the complete output in CODE tags.
Code:
defaults read loginwindow AutoLaunchedApplicationDictionary
 
Last edited:
  • Like
Reactions: CharlieJames91

CharlieJames91

macrumors newbie
Original poster
Jun 3, 2016
16
1
First, read about using CODE tags in posts:
https://forums.macrumors.com/threads/posting-code-please-use-the-code-tags.747660/


Test #1:

Paste the following commands into Terminal. Post the complete output in CODE tags.
Code:
osascript -e 'tell application "System Events" to get count of login items'

osascript -e 'tell application "System Events" to get the name of every login item'


Test #2:

Paste the following command into Terminal. Post the complete output in CODE tags.
Code:
defaults read loginwindow AutoLaunchedApplicationDictionary

Thanks for the heads up. the Apple script actually does work, just not with elevated privileges. In fute I will use the CODE tags, also.

Thank you.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.