Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Zogw

macrumors newbie
Original poster
Jan 24, 2013
5
0
Is there a command that anyone knows of that will make an application open on startup? I know how to do it manually, but can it be done from Terminal? Thanks.
 

CylonGlitch

macrumors 68030
Jul 7, 2009
2,956
268
Nashville
Not 100% sure what you want. You can go to the Preferences Panel, Users & Groups, Login Items and add things there. Is that what you want?
 

Zogw

macrumors newbie
Original poster
Jan 24, 2013
5
0
Sorry, I guess I was a little unclear. I'm wondering if there's an actual command that one can type in terminal that will make an application open at startup. For example, the command that hides files is
Code:
chflags hidden ~/yourfile/
so, something like that.
 

LPZ

macrumors 65816
Jul 11, 2006
1,221
2
Sorry, I guess I was a little unclear. I'm wondering if there's an actual command that one can type in terminal that will make an application open at startup. For example, the command that hides files is
Code:
chflags hidden ~/yourfile/
so, something like that.

The open command can be used to open an application. With the help of launchd, it can be invoked at login. For an example, create a file named local.example.safariopener.plist and paste in the following text:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>local.example.safariopener</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/open</string>
        <string>-a</string>
        <string>/Applications/Safari.app</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Save the file and place it in ~/Library/LaunchAgents, where ~ denotes your home folder. The next time you log in, Safari should open automatically.
 
Last edited:

Zogw

macrumors newbie
Original poster
Jan 24, 2013
5
0
Oh I tried it, and it doesn't work. I think I might be confused about which Library folder to put it in as I have one for the user and one for the system. I tried it for the user (the home folder).
 

LPZ

macrumors 65816
Jul 11, 2006
1,221
2
Oh I tried it, and it doesn't work. I think I might be confused about which Library folder to put it in as I have one for the user and one for the system. I tried it for the user (the home folder).

Sorry, a mistake in my post. Forgot the correct suffix on the filename.

Name the file local.example.safariopener.plist, not local.example.safariopener. It should open Safari on log in. If you place it in ~/Library/LaunchAgents (in your home folder), it will only work for you. If you place it in /Library/LaunchAgents, it should work on login for each user.

Sorry for the error.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.