Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Applications > Mac Applications and Mac App Store

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 24, 2013, 05:41 PM   #1
Zogw
macrumors newbie
 
Join Date: Jan 2013
Terminal run on startup command

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.
Zogw is offline   0 Reply With Quote
Old Jan 24, 2013, 05:55 PM   #2
CylonGlitch
macrumors 68030
 
CylonGlitch's Avatar
 
Join Date: Jul 2009
Location: SoCal
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?
__________________
Last edited by CylonGlitch : Tomorrow at 37:05 AM.
MRoogle
CylonGlitch is offline   0 Reply With Quote
Old Jan 24, 2013, 06:07 PM   #3
Zogw
Thread Starter
macrumors newbie
 
Join Date: Jan 2013
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.
Zogw is offline   0 Reply With Quote
Old Jan 24, 2013, 07:33 PM   #4
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by Zogw View Post
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 by LPZ; Jan 26, 2013 at 05:34 AM. Reason: Fixed error by adding .plist to file name.
LPZ is offline   1 Reply With Quote
Old Jan 24, 2013, 08:03 PM   #5
Zogw
Thread Starter
macrumors newbie
 
Join Date: Jan 2013
Thanks, that sounds good.
Zogw is offline   0 Reply With Quote
Old Jan 25, 2013, 09:32 PM   #6
Zogw
Thread Starter
macrumors newbie
 
Join Date: Jan 2013
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).
Zogw is offline   0 Reply With Quote
Old Jan 26, 2013, 05:12 AM   #7
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by Zogw View Post
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.
LPZ is offline   1 Reply With Quote
Old Jan 26, 2013, 10:24 AM   #8
Zogw
Thread Starter
macrumors newbie
 
Join Date: Jan 2013
Thanks, it worked perfectly!
Zogw is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Applications > Mac Applications and Mac App Store

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Terminal command andynewfriends Mac Basics and Help 0 Jun 11, 2013 01:25 PM
Delay command in Terminal Darundal Mac Programming 4 May 13, 2013 05:02 AM
Run Terminal Command as root on Startup evilblob OS X 10.8 Mountain Lion 1 Aug 2, 2012 01:25 AM
run terminal command current finder window SniperUK Mac Applications and Mac App Store 3 Jul 30, 2012 01:52 PM
Need command in terminal chadteetzen OS X 1 Jun 8, 2012 10:55 PM

Forum Jump

All times are GMT -5. The time now is 07:53 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC