Skip to end of metadata
Go to start of metadata
You are viewing documentation of TeamCity 4.x, which is not the most recent released version of TeamCity. Please refer to the listing to choose another version.

Table of Contents

This page covers:

Before you can start customizing projects and creating build configurations, you need to configure build agents.

  • If you install TeamCity bundled with a Tomcat servlet container, or opt to install an agent for Windows, both the server and one build agent are installed. This is not a recommended setup for production purposes, since the build procedure can slow down the responsiveness of the web UI and overall TeamCity server functioning. If you need more build agents, perform the procedure described below.
  • For production installations it is recommended to adjust Agent's JVM parameters to include -server option.

Installing Additional Build Agents


Please note that in order to run a TeamCity build agent, user account that is running the agent should have the following privileges:

  • Log on as a service (to run as Windows service)
  • Start/Stop service (to run as Windows service, necessary for agent upgrade to work)
  • Debug programs (for take process dump functionality to work)
  • Have permissions to rewrite the following directories: <agent home>, <agent work>, and <agent temp>.

For granting necessary permissions for unprivileged users, see Microsoft SubInACL utility. For example, to grant Start/Stop rights you might need to execute subinacl.exe /service browser /grant=<login name>=PTO command.

You can install an additional build agent using any of the following installation options available:

When the newly installed agent connects to the server for the first time, it appears on the Unauthorized agents tab under Agents, where administrators can authorize it. This will connect the agent to the server for the first time.


Agents will not run builds until they are authorized and enabled. The agent running on the same computer as the server is authorized and enabled by default.

Installing via Java Web Start

  1. Make sure JDK 1.5+ is properly installed on the computer.
  2. On the agent computer, set up the JAVA_HOME environment variable to point to the JDK 1.5+ installation directory.
  3. Navigate to the Agents tab in the TeamCity web UI.
  4. Click the "Install Build Agents" link and then click "Via Java Web Start".
  5. Follow the instructions.

    You can install the build agent Windows service during the installation process or manually.

Installing via a MS Windows installer

  1. Navigate to the Agents tab in the TeamCity web UI.
  2. Click the "Install Build Agents" link and then click MS Windows Installer link to download the installer.
  3. Run the agentInstaller.exe Windows Installer and follow the installation instructions.

Installing via ZIP File

  1. In TeamCity Web UI, navigate to the Agents tab
  2. Click the Install Build Agents link and then click download zip file
  3. Unzip the downloaded file into the desired directory.
  4. Make sure that you have a JDK or JRE installed (You will need JDK (not JRE) for some build runners like Ipr runner, Inspections, and Duplicates). Please ensure that the JRE_HOME or JAVA_HOME environment variables are set (pointing to the installed JRE or JDK directory respectively) for the shell in which the agent will be started.
  5. Navigate to the <installation path>\conf directory, locate the file called and rename it to
  6. Edit the file to specify the TeamCity server URL and the name of the agent. Please refer to Build Agent Configuration section for more details on agent configuration
  7. Under Linux, you may need to give execution permissions to the bin/ shell script.

    On Windows you may also want to install the build agent windows service instead of manual agent startup.

Starting the Build Agent

To start the agent manually, run the following script:

  • for Windows: <installation path>\bin\agent.bat start
  • for Linux and MacOS X: <installation path>\bin\ start

    If you're running build agent on MacOS X and you're going to run Inspection builds, you may need to use the StartupItemContext utility:

Stopping the Build Agent

To stop the agent manually, run the <Agent home>\agent script with a stop parameter.

Use stop to request stopping after current build finished.
Use stop force to request immediate stop (if a build is running on the agent, it will be stopped abruptly (canceled))
Under Linux, you have one more option top use: stop kill to kill the agent process.

If the agent runs with a console attached, you may also press Ctrl+C in the console to stop the agent (if a build is running it will be canceled).

Installing and Running a Build Agent as a Windows Service

In Windows, you may want to use the build agent Windows service to allow the build agent to run without any user logged on.

Note to users upgrading from version 1.2


Since version 1.2, Build Agents are using a new Windows Service Library: Java Service Wrapper. The old service name, agentd, is no longer used in fresh installations. Agents that were already installed will continue to use old service until explicit installation. (more information)

To install the service:

  1. Make sure there is no TeamCity Build Agent Service <build number> or agentd service already installed, if installed, uninstall the agent.
  2. Check property in <agent home>\launcher\conf\wrapper.conf file to contain valid path to Java executable in the JDK installation directory. You can use for agent installed with Windows distribution.
  3. Run the <agent home>/bin/service.install.bat file.

To start the service:

  • Run <agent home>/bin/service.start.bat

To stop the service:

  • Run <agent home>/bin/service.stop.bat

The service wrapper allows to change agent JVM parameters via the configuration file: <agent home>\launcher\conf\wrapper.conf


The agent process name is TeamCityAgentService-windows-x86-32.exe.

While using net.exe utility, use TCBuildAgent name. For example:

Service system account


To run builds, the build agent should be started under a user with enough permissions for performing a build. By default, Windows service in started under SYSTEM ACCOUNT. To change it, use the Services applet (Control Panel|Administrative Tools|Services)

Using LaunchDaemons Startup Files on MacOSx

For MacOSx, TeamCity provides ability to load a build agent automatically at the system startup using LaunchDaemons plist file.


LaunchDaemons startup files support is available since TeamCity 4.0.1.

To use LaunchDaemons plist file:

  1. Install build agent on Mac either via or via Java web-start
  2. Prepare conf/ file
  3. Load build agent to LaunchDaemon via command:

    You have to wait several minutes for the build agent to auto-upgrade from the TeamCity server.

  4. Copy buildAgent/bin/jetbrains.teamcity.BuildAgent.plist to /Library/LaunchDaemons directory for automatic startup (you may need to create this directory, if it doesn't exists)
  5. To stop build agent, run the following command:

Installing Several Build Agents on the Same Machine

Several agents can be installed on a single machine. They function as separate agents and TeamCity works with them as different agents, not utilizing the fact that they share the same machine.
After installing one agent you can install additional one, providing the following conditions are met:

  • the agents are installed in the separate directories
  • they have distinctive work and temp directories
  • is configured to have different values for name and ownPort properties

Make sure, there are no build configurations that have absolute checkout directory specified (alternatively, make sure such build configurations have "clean checkout" option enabled and they cannot be run in parallel).

Under Windows, to install additional agents as services, modify <agent>\launcher\conf\wrapper.conf to change wrapper.console.title,, wrapper.ntservice.displayname and wrapper.ntservice.description properties to have distinct name within the computer.

See Also: