Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
[Solved] MacOS X - How to add, remove, view items to the Login Items from Terminal
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
Topic starter
September 12, 2015 5:25 AM
Add an item:
osascript -e 'tell application "System Events" to make login item at end with properties {path:"/path/to/yourapp", hidden:false}'
Remove an item:
osascript -e 'tell application "System Events" to delete login item "yourappname"'
List all items:
osascript -e 'tell application "System Events" to get the name of every login item'
Enjoy!
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2859
Topic starter
May 7, 2016 1:57 PM
Note:
You can also use the following to add an app:
osascript -e 'tell application "System Events" to make login item at end with properties {name:"AppName",path:"/path/to/yourapp", hidden:false}'
You can also call for the paths of all login items:
osascript -e 'tell application "System Events" to get the path of every login item'