In El Capitan how can I get an applescript to make itself open at login? Such as adding it to the login items automatically?

I want to be able to send people the applescript and the first time they open it, it automatically sets itself to open at login in future.

If applescript is too limiting I don't mind using a cocoa applescript in Xcode, although I would like to avoid it.


Add it to the login items (like you mentioned.) Note that (to accomplish this easily) you have to save it as an application bundle.

Using this guide, you can automate the process.

tell application "System Events"
    -- Adding a login item for the current user
    make new login item at end of login items with properties {path:"/Applications/**{YOUR APP HERE}**", hidden:false}
end tell`
  • This didn't quite work until I added a title in the properties next to the path. Although a quick google of the code set me on the right path – cjeccjec Mar 10 '16 at 1:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .