Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 30, 2013, 04:48 PM   #1
pickaxe
macrumors 6502a
 
Join Date: Nov 2012
Open app as root on user login?

Some of the apps I regularly use require root access, otherwise I'd be typing my password repeatedly. (for example, TunlrSwitcher would otherwise pop up a password prompt every time I try to change the DNS)

So I run these apps as root via terminal, but the sudo command obviously requires a password. This is a problem because I want these apps to run on boot without having to manually type in my password to launch them. Is there some way to do this? Windows has a few workarounds IIRC.
pickaxe is online now   0 Reply With Quote
Old Jul 30, 2013, 04:51 PM   #2
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
sudo crontab? It's what I would use on Linux, and I think it'll work on OS X, but I don't know if that's a solution that Apple would recommend.
ArtOfWarfare is offline   0 Reply With Quote
Old Jul 30, 2013, 09:22 PM   #3
$yregnar86
macrumors newbie
 
Join Date: Jul 2013
tried looking at it's permissions?
$yregnar86 is offline   0 Reply With Quote
Old Jul 31, 2013, 02:58 PM   #4
ElectricSheep
macrumors 6502
 
Join Date: Feb 2004
Location: Wilmington, DE
Send a message via AIM to ElectricSheep
The recommended way of doing this is via launchd. You create a reverse-domain named .plist file following the specifications laid out in the launchd.plist man page. For example, I like to have my IRC bouncer to be running after booting my laptop without having to remember to login and start it. I created a file called com.electricsheep.znc.plist with the following contents:

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>com.electricsheep.znc</string>
                <key>ProgramArguments</key>
                <array>
                        <string>/usr/local/bin/znc</string>
                        <string>-f</string>
                        <string>-r</string>
                        <string>--datadir=/Users/esheep/.znc/</string>
                </array>
                <key>KeepAlive</key>
                <true/>
                <key>UserName</key>
                <string>esheep</string>
        </dict>
</plist>
The plist file was dropped into /Library/LaunchDaemons. From there, the system's launchd instance manages starting znc automatically, and making sure that its still running even if it exits abnormally.

The man page for launchd.plist outlines the options available for configuring launch agents and daemons.
__________________
15'' MBP (early 2011) | i7 3770k Hackintosh | i7 Mac Mini (late 2012) | iPhone 5 | iPad 3 (2012) | iPad mini | MacOS X 10.9.2
ElectricSheep is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
How do you tell if Root user is logged in on Mavericks? Jazzandmetal? Mac Basics and Help 1 Nov 18, 2013 11:28 PM
how come iOS doesn't let users login as root? dxyovak iOS 6 2 Jun 13, 2013 09:18 PM
Applications installing in root instead of user folder? dapitts08 OS X 10.8 Mountain Lion 4 Apr 14, 2013 08:28 AM
Network user login - can't create new user, probably related to home folder JimboStormforce Mac OS X Server, Xserve, and Networking 12 Aug 27, 2012 06:58 AM
Can you have different login/root passwords? ender land OS X 2 Jul 20, 2012 10:40 AM

Forum Jump

All times are GMT -5. The time now is 01:08 AM.

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

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