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 everyone.

Does anyone know how to startup applications via terminal upon startup/login? The machines ae all on 10.11.

Please help.

Thanks,
 
Hi everyone.

Does anyone know how to startup applications via terminal upon startup/login? The machines ae all on 10.11.

Please help.

Thanks,

Not sure I quite understand the question, but I'll try to help.

You can open applications by typing open -a "xxxx"; for instance, open -a "App Store" will open the App Store if it's in the Applications folder. The '-a' modifier isn't necessary, but there are a lot of other options you can open an app with if you're interested.

If it's an app outside of the Applications folder, you can use open -a FILEPATH. Filepath being, for example, open -a Users/Username/Documents/App-You-Want-To-Open.app

If it's a file you just want to open, you can just say open FILEPATH. So if it's a document, open Users/Username/Documents/Document-You-Want-To-Open.docx

However there's a much easier way to open apps on startup. Just open the app as you normally would. You'll see it in the Dock at the bottom. Right-click that and select 'Options>Open at Login'. Then that app will always start as soon as you open the computer.

Could you outline exactly what you're trying to do (i.e., the scenario you need the fix for)? This might help us a little more. :)
 
  • Like
Reactions: CharlieJames91
Hi,


Essentially I just need a script that will add an application to the startup applications via system preferences. Manually adding the application is not an option as we need to push this out on to a large number of machines. So ideally if we could just push out a script that will add this specific application to login items that would be PERFECT.


Thank you for your reply.
[doublepost=1472657058][/doublepost]
Not sure I quite understand the question, but I'll try to help.

You can open applications by typing open -a "xxxx"; for instance, open -a "App Store" will open the App Store if it's in the Applications folder. The '-a' modifier isn't necessary, but there are a lot of other options you can open an app with if you're interested.

If it's an app outside of the Applications folder, you can use open -a FILEPATH. Filepath being, for example, open -a Users/Username/Documents/App-You-Want-To-Open.app

If it's a file you just want to open, you can just say open FILEPATH. So if it's a document, open Users/Username/Documents/Document-You-Want-To-Open.docx

However there's a much easier way to open apps on startup. Just open the app as you normally would. You'll see it in the Dock at the bottom. Right-click that and select 'Options>Open at Login'. Then that app will always start as soon as you open the computer.

Could you outline exactly what you're trying to do (i.e., the scenario you need the fix for)? This might help us a little more. :)

#4
Hi,


Essentially I just need a script that will add an application to the startup applications via system preferences. Manually adding the application is not an option as we need to push this out on to a large number of machines. So ideally if we could just push out a script that will add this specific application to login items that would be PERFECT.


Thank you for your reply.
 
Hi,


Essentially I just need a script that will add an application to the startup applications via system preferences. Manually adding the application is not an option as we need to push this out on to a large number of machines. So ideally if we could just push out a script that will add this specific application to login items that would be PERFECT.


Thank you for your reply.
[doublepost=1472657058][/doublepost]

#4
Hi,


Essentially I just need a script that will add an application to the startup applications via system preferences. Manually adding the application is not an option as we need to push this out on to a large number of machines. So ideally if we could just push out a script that will add this specific application to login items that would be PERFECT.


Thank you for your reply.
Configuration profiles are a good way to do this. You can also create LaunchAgents which can do this too.
 
Does that app that needs to be always open, have a name?
It already has a Dock icon, correct?

What is the result if one of those users decides to just quit that application, or the app quits when you close the app's window (some apps do that)?
If you quit the application, then you have to do something to re-launch the app (Apps don't stay open forever, just because they launch as a startup item. If you decide to Quit the app, it quits… This is not Windows :D )

Maybe you should ALSO have a script that continually checks for that app, and re-launches it automatically, if closed?
 
Does that app that needs to be always open, have a name?
It already has a Dock icon, correct?

What is the result if one of those users decides to just quit that application, or the app quits when you close the app's window (some apps do that)?
If you quit the application, then you have to do something to re-launch the app (Apps don't stay open forever, just because they launch as a startup item. If you decide to Quit the app, it quits… This is not Windows :D )

Maybe you should ALSO have a script that continually checks for that app, and re-launches it automatically, if closed?


Hi there, it is not a problem if the user quits the app, we just want the app to start at startup - that's all.

Thank you
[doublepost=1472660887][/doublepost]
Does that app that needs to be always open, have a name?
It already has a Dock icon, correct?

What is the result if one of those users decides to just quit that application, or the app quits when you close the app's window (some apps do that)?
If you quit the application, then you have to do something to re-launch the app (Apps don't stay open forever, just because they launch as a startup item. If you decide to Quit the app, it quits… This is not Windows :D )

Maybe you should ALSO have a script that continually checks for that app, and re-launches it automatically, if closed?

The application in question is Lync. nothing extra is needed i.e dock icon etc, just simply needs to be added to the login items on system pref.

Thank you
 
Login items are not persistent, your users can remove these. If you want to enforce this behaviour, then you should use system-wide launch agents to get the behaviour you want, but they are obviously not shown in System Preferences. It is possible to add login items using AppleScript and the osascript command-line utility. What is it that you want to achieve exactly?
 
The application in question is Lync. nothing extra is needed i.e dock icon etc, just simply needs to be added to the login items on system pref.

Thank you
Again, Configuration profiles are the way to do this, and allow a lot of other management options that might be valuable.
 
Login items are not persistent, your users can remove these. If you want to enforce this behaviour, then you should use system-wide launch agents to get the behaviour you want, but they are obviously not shown in System Preferences. It is possible to add login items using AppleScript and the osascript command-line utility. What is it that you want to achieve exactly?

Hi there, the users can remove this start up application if they wish, it's more so to just make the user aware that the application is there, if we get the application to start up automatically when they sign in then we can let their curiosity go from there, and they can remove if they wish. I have been unable to find any easy way around this on el capitan. I know back a couple os's like 10.4 there was a folder in the user library that could easily be edited but not so much anymore. I've tried using opensnooping to monitor the changes when I manually add an application to login items but not much luck so far
[doublepost=1472676187][/doublepost]
Again, Configuration profiles are the way to do this, and allow a lot of other management options that might be valuable.
I will look into configuration profiles, thanks. Our users are already setup etc via AD which is why I just want to to push out a script to add an app to their login items
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.