Mac setup for Mobile DevOps with Visual Studio Team Services

Not only is DevOps one of the hottest topics, but Mobile DevOps is where we are all heading.  For a complete Mobile DevOps solution, you need to be able to target all three platforms in an automated fashion.  Visual Studio Team Services with the addition of HockeyApp, Xamarin, and Xamarin Test Cloud is a complete Mobile DevOps solution.

Visual Studio Team Services can be used for any language targeting any platform.  When you develop for iOS, you are required to use a Mac.  Visual Studio Team Services' build agent can be installed on a Mac to enable Continuous Integration for iOS builds as well.  The purpose of this post is to detail exactly what you have to do to configure your Mac to work with Visual Studio and Visual Studio Team Services.  I am new to the world of OS X so I will go into great detail for others like me that find navigating OS X awkward at best.

When we are done, we will be able to connect to this Mac from Visual Studio during our daily mobile development and also have it execute our Continuous Integration builds from Visual Studio Team Services.  If you prefer not to actually have to touch the Mac, you can read how to control it from your PC here.

I will be starting with a virgin MacBook Pro with the following specs:

SNAGHTML5b962cb
The first thing we are going to have to do is install Xcode.
  1. Press Command (⌘) - Space
  2. Type App Store
  3. Press Enter
  4. Type xcode in Search
  5. Press Enter
    image
  6. Click Get
    Or click Install if you have already installed before using your Apple ID.

This install may take a while.  While it is installing, we are going to enable Remote Login so Visual Studio can connect to this Mac and use it for building iOS applications.

  1. Press Command (⌘) - Space to open Spotlight Search
    image_thumb
  2. Type Remote
  3. Press Enter
  4. Check Remote Login
  5. Select System Preferences / Quit System Preferences

Now Visual Studio will be able to find this Mac on your network.
image

Before performing the next steps, I would wait for Xcode to completely install. You will know when the installation is complete when the installing button reads Open.
image

Once the installation is complete, open Xcode so we can accept the license.

  1. Press Command (⌘) - Space
  2. Type xcode
  3. Press Enter
  4. Click Agree
  5. Enter your Password
  6. Click OK
  7. Select Xcode / Quit Xcode

I ran into some issues when I tried to download certain files using Safari so we are going to install Chrome.

  1. Press Command (⌘) - Space
  2. Type Safari
  3. Press Enter
  4. Visit http://Chrome.com
  5. Click Download now
  6. Click Downloads icon in the dock
    image
  7. Click googlechrome.dmg
  8. Drag Google Chrome icon to the Applications folder
  9. Close the Google Chrome installer window

Now we can install Xamarin Studio and the Visual Studio Team Services build agent.

  1. Press Command (⌘) - Space
  2. Type Chrome
  3. Press Enter
  4. Click Open
  5. Visit https://www.xamarin.com/download
  6. Complete form
  7. Click Download Xamarin Studio for OS X
  8. Click Downloads icon in the dock
    image
  9. Click XamarinInstaller.dmg
    image
  10. Double-click button
    image
  11. Click Open
    image
  12. Check I accept the terms of the License Agreement
  13. Click Continue
  14. Check all that apply (Xamarin.iOS is only requirement)
  15. Click Continue
  16. Verify installation location
  17. Click Continue
  18. Review prerequisites
  19. Click Continue
  20. Check Accept licenses
  21. Click Continue
  22. Enter Password
  23. Click OK
    You may have to enter your password several times during the installation.
  24. Minimize browser the that opens
  25. Click Quit

The final preparation of our Mac will be installing the Visual Studio Team Services build agent. Before we install the agent, we need to make sure and install the latest version of OpenSSL which as of this writing is 1.0.2h.  I found the easiest way to install OpenSSL is using Homebrew.  Installing Homebrew is pretty simple.

  1. Press Command (⌘) - Space
  2. Type Terminal
  3. Press Enter
  4. Enter the following command:
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  5. Press Enter
  6. Enter Password
  7. Press Enter

With Homebrew installed, we can now upgrade OpenSSL. In the terminal window we just used to install Homebrew, run the following commands:

  1. brew update
  2. brew install openssl
  3. brew link --force openssl
  4. Select Terminal / Quit Terminal
  5. Press Command (⌘) - Space
  6. Type Terminal
  7. Press Enter
  8. Enter the following command:
    openssl version
    The results should be higher than or equal to 1.0.2h
    image

With the latest version of OpenSSL installed, we can complete the final step and install the build agent. To complete the installation, we are going to need to create a Personal Access Token in Visual Studio Team Services.

  1. Press Command (⌘) - Space
  2. Type Chrome
  3. Press Enter
  4. Visit https://{YourAccount}.visualstudio.com 
    Log in if needed
  5. Click your name in the upper right-hand corner
    image
  6. Click My security
  7. Click Add
  8. Enter appropriate values
  9. Click Create Token
  10. Copy the token value and store it somewhere safe
    image

Armed with our Personal Access Token, we can download the agent.

  1. Press Command (⌘) - Space
  2. Type Chrome
  3. Press Enter
  4. Visit https://github.com/Microsoft/vsts-agent
  5. Click the for OSX
    image
  6. Click link for the latest OSX build
    image
  7. Click Downloads icon in the dock
  8. Click vsts-agent-osx.10.11-x64-2.101.1.tar file
    Your version may vary. The file will be extracted into your Downloads folder and the Downloads folder will open.
  9. Right-click the vsts-agent-osx.10.11-x64-2.101.1 folder
  10. Select Copy “vsts-agent-osx.10.11-x64-2.101.1”
  11. Click Documents under Favorites
  12. Right-click the background
  13. Select Paste Item
  14. Rename folder to A1
  15. Press Command (⌘) - Space
  16. Type Terminal
  17. Press Enter
  18. Enter the following command:
    cd Documents/A1/
  19. Enter the following command:
    ./config.sh
  20. Enter Password
  21. Press Enter
  22. Enter Y
  23. Press Enter
  24. Enter the URL of your Visual Studio Team Services account in the following format:
    https://{YourAccount}.visualstudio.com
  25. Press Enter to accept PAT as the authentication type
  26. Enter the Personal Access Token we created earlier
  27. Press Enter to accept default as the agent pool
  28. Enter a name for your agent or press Enter to accept the default name
  29. Press Enter to accept _work as the work folder
  30. Enter Y to run agent as a service
  31. Press Enter

You can verify the agent was successfully installed from your Visual Studio Team Services account.

image

In future posts, I will show you how to connect this Mac to Visual Studio and use it as your CI machine now that it is set up.

Comments (7) -

  • Hi Donovan.

    I am trying to automate the deployment of Xamarin iOS app through VSTS via fastlane tools. Someone suggested to use "Cake" builds and automate fastlane tools via VSTS. Can you advise me on how I can achieve that. Also, can you also tell me:
    1. If we have any better Xamarin iOS deployment steps till the appstore in VSTS, similar to fastlane ??
    2. If not are you planning to add those steps?
    3. Can you suggest tools which I can use to automate the deployment of  my Xamarin iOS app into appstore.
    • I have not used fastlane. I only use HockeyApp and VSTS. VSTS is working on publishing to the appstore.
  • Hi

    Great article, thanks. I am running into issues with doing this on Mac Sierra(10.12.3).

    I cannot get past upgrading the OpenSSL. I found this great walkthrough however still no go.

    https://medium.com/@katopz/how-to-upgrade-openssl-8d005554401#.fxsx0fjk6

    Any help appreciated.
    • What error are you getting?
      • Hi

        Thanks for responding.  

        I am getting the error outlined in the article I sent.

        ln: /usr/bin/openssl: Operation not permitted

        I have not tried anything suggested from article about system integrity that points here.

        apple.stackexchange.com/.../208481#208481

        I am scared I will brick the Mac. :-(

        Thanks

        PS way to kill it at launch yesterday! Tong
      • HI

        I fixed this by modifying my ~/.bash_profile to point terminal to OpenSSL version downloaded with homebrew. Note my version as of now is 1.0.2.k so future versions this will change.

        export PATH=/usr/local/Cellar/openssl/1.0.2k/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

Pingbacks and trackbacks (1)+

Add comment

Loading