How do I set a command on a profile so that when I start a new terminal window, it fires off that command.

Specifically, I'd like to be able to set my virtualenv with:

workon ENV

So that it starts automatically into my virtual environment when that I use that profile.


Profiles -> General -> Command


Everytime you open a new tab your bash profile will be sourced.

  • What if you only want to launch it the first time iterm2 starts up? And not every time a new tab is opened?
    – Jens Bodal
    Feb 11 at 19:44

Got it, there is an option added in the development branch of iTerm that adds a "Send text at start" option to the profile settings. This will eventually be added to a (more) stable version of iTerm.

  • 1
    How to run multiple commands one after another in same profile tab?
    – Metal Gear
    Sep 5 '14 at 7:42
  • Can't seem to execute multiple commands either using iTerm2 - attempting to 'make configure', and then 'make service'. Any ideas appreciated!
    – zero_cool
    Oct 27 '15 at 17:15
  • 3
    You can separate commands with a ; and that will allow multiple commands on one line. In this example make configure; make service should work. Oct 28 '15 at 21:20
  • Try command1 && command2 Feb 13 '20 at 1:38

In iTerm2, preferences>profiles>tab general, there is an option in Command called send text at start that executes any command you put there after login.

In particular, I typically have

source ~/.virtualenvs/.../bin/activate

for profiles that use Python.


Using the image to illustrate, please note the command selection and Send text at start: option.

enter image description here


You must log in to answer this question.

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