10 Replies Latest reply: Nov 4, 2010 6:14 PM by jsd2
macuser1801 Level 1 Level 1 (5 points)
Hi,

I would like to know if there is any way of running an application as root by just clicking on the app's icon instead of going to the terminal window every time.

Thank you.

Macbook C2D, Mac OS X (10.6.4)
  • jsd2 Level 5 Level 5 (6,200 points)
    Take a look at [Pseudo|http://personalpages.tds.net/~brian_hill/pseudo.html].
  • baltwo Level 9 Level 9 (62,205 points)
    Why?
  • MartinR Level 6 Level 6 (14,860 points)
    What app is it and why do you want to run it as root?
  • macuser1801 Level 1 Level 1 (5 points)
    The app is GNS3..In order for me to work with the tap drivers and GNS3, I need to run the application as root so I can save it.

    Here was my original situation, I run GNS3 as root and I created a tap interface. I assigned an ip address and subnet mask to it. I saved my project and next time I opened it, it said that i couldn't create the interface. I opened it with root access and I got it back but the ip address and mask were gone.

    Now, I am trying to open it with root access so I don't have any issues.
  • g_wolfman Level 4 Level 4 (1,120 points)
    You'd be better off creating a LaunchDaemon that changes the permissions on the bpf devices. For example, one called org.tcpdump.chmod_bpf.plist with the following contents:


    <?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>org.tcpdump.chmod_bpf</string>
    <key>Program</key>
    <string>/usr/local/bin/chmod_bpf</string>
    <key>RunAtLoad</key>
    <true/>
    </dict>
    </plist>

    Then in /usr/local/bin, you have the chmod_bpf script (owner root:wheel, perm 755) with the contents:

    #! /bin/sh
    chgrp admin /dev/bpf*
    chmod g+rw /dev/bpf*


    That way you can set up interfaces without having to run programs as root.

    Basically, this is the setup for Wireshark, which I modified from a startup item to a LaunchDaemon following similar advice on the tubes (I take no credit for the idea at all).

    Cheers.
  • macuser1801 Level 1 Level 1 (5 points)
    I have created org.tcpdump.chmod_bpf.plist as you indicated on your post but I don't know where to drop it. I have two LaunchDaemon folders

    1. Under hard drive/Library
    2. Under system/library

    Where can I find /usr/local/bin?

    I apologize but my expertise of Mac is very limited.

    Thank you.
  • etresoft Level 7 Level 7 (27,125 points)
    Write an AppleScript application that runs the terminal version with authorization.
  • macuser1801 Level 1 Level 1 (5 points)
    Guys,

    I apologize but I am not a developer and I have little knowledge when it comes to Mac os x folder structure; therefore, it is hard for me to implement some of those scripts you have suggested.

    How do I do an applescript? Remember, I don't want just to run terminal as a root but the application itself. I don't want to use terminal every time I have to open GNS3.

    Thanks.
  • baltwo Level 9 Level 9 (62,205 points)
    Then, inquire at http://www.gns3.net/ on how to get it running properly.
  • jsd2 Level 5 Level 5 (6,200 points)
    Did you look at Pseudo ?
    http://personalpages.tds.net/~brian_hill/pseudo.html

    It's a very old program, but it still seems to work in OS X 10.6.

    You can drag an application icon into the Pseudo window to run the app as root, or you can use Pseudo's File menu to easily create and save a "Launch Document" for an application. Double-clicking such a Launch Document then runs the application as root. You can optionally store the admin password needed for authentication in your keychain.