Forked from kaloprominat/macos: manage add list remove login items apple script
          
        
    
          Created
          July 24, 2020 06:20 
        
      - 
      
- 
        Save zhiyue/df504cf77b509d5532cf954c100867d3 to your computer and use it in GitHub Desktop. 
    macos: manage add list remove login items apple script
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # applescript | |
| # add login item | |
| osascript -e 'tell application "System Events" to make login item at end with properties {name: "Notes",path:"/Applications/Notes.app", hidden:false}' | |
| # delete login item | |
| osascript -e 'tell application "System Events" to delete login item "itemname"' | |
| # list loginitems | |
| osascript -e 'tell application "System Events" to get the name of every login item' | |
| # with defaults | |
| defaults write loginwindow AutoLaunchedApplicationDictionary -array-add '{ "Name" = "Notes" ; "Path" = "/Applications/Notes.app"; "Hide" = 0; }' | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment