Autostart TeamCity on Mac
Last modified: 20 April 2023Starting up TeamCity server on Mac is quite similar to starting Tomcat on Mac.
Install TeamCity and make sure it works if started from command line, with bin/teamcity-server.sh start. We assume that TeamCity is installed in /Library/TeamCity folder
Create file /Library/LaunchDaemons/jetbrains.teamcity.server.plist with the following content:
<?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>WorkingDirectory</key> <string>/Library/TeamCity</string> <key>Debug</key> <false/> <key>Label</key> <string>jetbrains.teamcity.server</string> <key>OnDemand</key> <false/> <key>KeepAlive</key> <true/> <key>ProgramArguments</key> <array> <string>bin/teamcity-server.sh</string> <string>run</string> </array> <key>RunAtLoad</key> <true/> <key>StandardErrorPath</key> <string>logs/launchd.err.log</string> <key>StandardOutPath</key> <string>logs/launchd.out.log</string> </dict> </plist>
Test your file by running launchctl load /Library/LaunchDaemons/jetbrains.teamcity.server.plist. This command should start TeamCity server (you can see this from logs/teamcity-server.log and in browser)
If you don't want TeamCity to start under root permissions, specify UserName key in the plist file, like this:
<key>UserName</key> <string>teamcity_user</string>
That's it. TeamCity now should autostart when machine starts.
Thanks for your feedback!