Open Terminal Here, as Root (OS X)

Posted by cwd on Super User See other posts from Super User or by cwd
Published on 2011-02-23T05:37:37Z Indexed on 2011/02/23 7:27 UTC
Read the original article Hit count: 198

Filed under:
|
|
|

There is a pretty awesome applescript called "Open Terminal Here" ( http://www.entropy.ch/software/applescript/ ) which you can add to your finder's toolbar and click when you want to launch a terminal console which is set to that directory.

Sometimes I need to be root, and so I end up starting terminal, doing something like sudo -i and then I have to change back to the previous directory because the sudo command is landing me in /var/root.

I'm using sudo -i because I like it to load things like aliases / the bash profile.

The script is applescript, and here's the important part of how it works:

    ...
    set cmd to "cd " & quoted form of the_path & " && echo $'\\ec'"
    ...
    tell application "Terminal"
        activate
        do script with command cmd

How do I get this to load as root?

© Super User or respective owner

Related posts about osx

Related posts about mac