So I have an executable program in my /usr/local/bin/ called myApp. I need to run multiple myApp processes in new iTerm2 tabs with sudo.

The file structure is like this:


The work flow is like this:

1) `cd` into `myFolder`
2) open *new tab*

3) in *new tab*, `cd` into `v1`

4) `sudo myApp`

5) *enter my password*

6) *repeat for all vi*

The issue is that I need to be able to automate this process. I found a osascript to open new tabs here, but I don't know how to have the newly opened tabs run myApp without asking my for password.


The only way I can think of doing this is by setting up sudo to not require a password. There are obvious security issues with this, but if those are acceptable in your situation, this is what I would do.

Edit the /etc/sudoers file with the visudo command:

# sudo visudo

Add a line at the bottom which grants the relevant user the ability to run any command as root without being prompted for a password (in this example adam is the user):


If you wanted a slightly more secure version, you could restrict them to only being able to run myApp without a password on a particular host (in this example the user is adam, the host is hebe and the only command they can run without a password is /usr/local/bin/myApp):

adam hebe = (root) NOPASSWD: /usr/local/bin/myApp

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .