Posted on 07-30-2018 06:56 AM
What is your favorite way to add a login item to your Mac? I have an app (IP in Menubar) that I'd like to start when our Macs start up.
I see there is a configuration profile for login items, but I don't see a way to add a custom application
Posted on 07-30-2018 07:39 AM
We use a script...
#!/bin/bash
#Task="add"
#App_Path="/Applications/NoMAD.app"
#Hidden="true"
Task="$4"
App_Path="$5"
Hidden="$6"
Item=`basename $App_Path`
Label=`basename $App_Path | awk -F "." '{print $1}'`
User_Name=`ls -l /dev/console | awk '{print $3}'`
App_Running=`ps -A | grep "$App_Path/Contents" | grep -v "grep"`
Existing_Items=( `/usr/bin/osascript -e 'tell application "System Events" to get the name of every login item' `)
Already_Exists=`echo ${Existing_Items[@]} | grep "$Label"`
if [ -z "$App_Path" ] || [ -z "$Task" ]; then
echo "Required variable is undefined!"
exit 0;
fi
if [ "$Task" == "add" ]; then
if [ -z "$Already_Exists" ] || [ "$Already_Exists" == '' ]; then
/usr/bin/osascript <<EOF
tell application "System Events" to make login item at end with properties {Path:"$App_Path", name:"$Item", hidden:$Hidden}
EOF
fi
if [ -z "${App_Running}" ] || [ "${App_Running}" == '' ]; then
open -a "${App_Path}" > /dev/null 2>&1
fi
fi
# The delete function
if [ "$Task" == "del" ]; then
if ! [ -z "$Already_Exists" ] || ! [ "$Already_Exists" == '' ]; then
/usr/bin/osascript <<EOF
tell application "System Events" to delete login item "$Item"
tell application "System Events" to delete login item "$Label"
EOF
fi
fi
exit 0;
Posted on 01-25-2019 05:57 AM
You can add "Items" under "Login Items" in the Config profile. Put the path to the .app file. Works the same way. FYI
Posted on 01-25-2019 06:52 AM
I create launchagents or daemons for everything.
Posted on 02-04-2019 07:13 AM
@tcarlson can you elaborate? I'm trying to do just what you mention, but after adding the path to my app and clicking Save, nothing shows up under Items. I've tried absolute and relative paths, etc. It acts like it just ignores what I've put in.
Posted on 02-04-2019 07:18 AM
@Hugonaut +1
Posted on 02-28-2019 07:33 AM
Under Logit items, go to "Items" instead of "apps"
Type in the application path ie : /Applications/Chess.app/
The only odd thing is that it will say "1 payload configured" but may or may not show the actual item once it is saved. But will still add item to the computer.
Posted on 05-03-2019 09:02 AM
@tcarlson I have added an app to the login items Profile but its not actually launching. I can see it in the Login Items window for the users and if I double click on it from there it launches properly but it just won't launch at login. Have you ever seen that? I have it entered into the Items section as /Applications/Chat.app/
Update: I found that the app loads fine for local accounts but wont load for Mobile accounts.
Posted on 06-04-2019 02:34 PM
@bruth85 I can also confirm the same behavior for mobile accounts.
Posted on 06-04-2019 03:15 PM
LaunchAgents can easily be set up for this purpose. Shameless plug.
Posted on 06-04-2019 03:42 PM
@ryan.ball I graciously accept your shameless plug! Will look into this.
Posted on 06-04-2019 03:51 PM
@Gascolator here is what I ended up doing atleast for now. Might need to change it but we will see. Working with Jamf we ended up creating a policy to trigger at Login and then within Files and Processes under the Execute a Command section entered open -a "Skype for Business" because we also wanted it to run when the user is not online we checked the Make available offline box. The other thing we had to add since Skype was trying to launch before wifi was connected was a quick script to add a wait and then set it to run Before. You may already know this but the one caveat and why we may need to change the policy is the policy has to run successfully once before the system will cache it to run offline. We have some computers who only run on wifi so if they login and are not connected to the network the policy may never actually run in order to cache it, but still working with Jamf on that part.
Posted on 06-04-2019 05:24 PM
FYI, login hooks are depreciated by Apple. Jamf policies that run at login use login hooks (as of now). launchd is the way to go.
Posted on 06-04-2019 06:26 PM
Went with a launch agent as @ryan.ball suggested above. Took the package it spit out and added it to the profile to install alongside Google Drive File Stream. Works great.
Posted on 09-10-2019 08:12 AM
Just wanted to thank @ryan.ball for the Launchd package creator. We just replaced a Mac lab that was running Sierra. Previously, I had a configuration profile that launched our GoPrint Webclient on login. After replacing our Mac lab with new iMacs running 10.14.5, I noticed the client was not launching for users logging in with their AD accounts, however, it would launch for local accounts. I used the utility to create a package (using the existing path in plist) and scoped it to my smart group for the new iMacs. The GoPrint Webclient is now launching for users logging in with their AD accounts.
Posted on 02-13-2023 08:13 AM
Late to the game here, but as of 10.43, you can add them to the Managed Login Items payload.
I just wanted to drop this in here in case someone arrived at this post as I did.
06-09-2023 03:06 AM - edited 06-09-2023 03:07 AM
Yes you can, but at least for me it doesn't launch app at login tried ading under items "/Applications/Google\ Chrome.app/" or "/Applications/Google\ Chrome.app" or even "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome" without quotes of cource.
Posted on 06-09-2023 03:28 AM
It works just yoo do not need to escape spaces like i did so "/Applications/Google Chrome.app/" works fine :)
Posted on 11-14-2023 12:09 PM
Thank you.