This is based on https://gist.github.com/rbuussyghin/0d7473a2692bdf6e0ef7
The change in my Gist is to add bash --login in front
Also note that the file launcher/bin/TeamCityAgentService-macosx-universal-32 may not be executable by default. You can add chmod +x run on that file to make it executable.