Installing a VSTS Build agent on Mac OSX

Today I needed to install the VSTS Build Agent on a Mac Mini in the office so we can build the IPhone App.

The great part of the new build infrastructure in VSTS is that it is Cross Platform and we CAN do that. Just download the agent and run the command provided in the interface.


But when I executed the steps as described in the documentation I ran into an error.

Enter server URL >
Enter authentication type (press enter for PAT) > 
Enter personal access token > ****************************************************
Connecting to server ...
The type initializer for 'System.Net.Http.CurlHandler' threw an exception.
Failed to connect. Try again or ctrl-c to quit

After some searches I found a number of URL’s which are listed at the bottom of this post. They set me on the right track, but none of them provided me with the direct fix. I am not a Mac user, so for me it is hard to directly find everything I need, but I managed :-).  This is what I did to fix the problem..

The problem

The problem is fairly straightforward. The VSTS Agent uses the OpenSSL library to connect securely to VSTS. The version that I used was 0.9.8 and I needed to upgrade the version.

Fix the problem

  • Open a terminal on your Mac
  • install HomeBrew by running the command
    /usr/bin/ruby -e "$(curl -fsSL 
  • install OpenSSL with brew
    brew install openssl --force
  • link the right openssl installation
    brew link --force openssl
  • After that, it still did not work with the following error
    Warning: Refusing to link: openssl
    Linking keg-only openssl means you may end up linking against the insecure,
    deprecated system OpenSSL while using the headers from Homebrew's openssl.
    Instead, pass the full include/library paths to your compiler e.g.:
      -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
  • It seems that still openssl is not found on the path as the right version. When I updated the $PATH variable, it worked
    export PATH=$PATH:/usr/local/opt/openssl/include
    openssl version

When I fixed the OpenSSL problem, I ran ./ of my VSTS Agent again and that worked fine !. When the config completed, it generated a file. With this file you can run the VSTS agent as a service. Just run

./ install
./ start

and you are done !




One Response to “Installing a VSTS Build agent on Mac OSX”

  1. Thanks for sharing

%d bloggers like this: