The OS X Build Environment

What This Guide Covers

This guide explains what packages, tools and settings are available in the Travis OS X CI environment (often referred to as the “CI environment”).

Overview

Travis CI runs builds in virtual machines that are snapshotted before each build and rolled back at the end of it. This offers a number of benefits:

  • Host OS is not affected by test suites
  • No state persists between runs
  • Passwordless sudo is available
  • It is possible for test suites to install various services via brew and then customize the configuration of those services at the beginning of each build.

The environment available to test suites is known as the Travis CI environment.

OS X Version

Travis CI uses OS X 10.9.5 (and Xcode 6.1) by default . You can use another version of OS X (and Xcode) by specifying the corresponding osx_image key from the following table:

osx_image valueXcode versionOS X version
osx_image: xcode8 Xcode 8gm OS X 10.11
osx_image: xcode7.3 Xcode 7.3.1 OS X 10.11
osx_image: xcode7.2 Xcode 7.2.1 OS X 10.11
osx_image: xcode7.1 Xcode 7.1.1 GM OS X 10.10
osx_image: xcode7 Xcode OS X 10.10
osx_image: xcode6.4 Xcode OS X 10.10
osx_image: beta-xcode6.3 Xcode OS X 10.10
osx_image: beta-xcode6.2 Xcode OS X 10.9
osx_image: beta-xcode6.1 Default Xcode OS X 10.9

At this time we are unable to provide pre-release versions of Xcode due to the NDA imposed on them. We do test them internally, and our goal is to make new versions available the same day they come out. If you have any further questions about Xcode pre-release availability, send us an email at support@travis-ci.com.

Homebrew

Homebrew is installed and updated every time the VMs are updated. It is recommended that you run brew update before installing anything with Homebrew.

A note on upgrading packages

When upgrading a package with brew upgrade, the command will fail if the most up-to-date version of the package is already installed (so an upgrade didn’t occur).

Depending on how you are upgrading the package, it could cause the build to error:

$ brew upgrade xctool
Error: xctool-0.1.16 already installed
The command "brew upgrade xctool" failed and exited with 1 during .

Your build has been stopped.

Or it can result in the command not found:

xctool: command not found

This is intended behaviour from Homebrew’s side, but you can get around it by running first checking if the command needs an upgrade with brew outdated, like this:

before_install:
  - brew update
  - brew outdated <package-name> || brew upgrade <package-name>

For example, if you always want the latest version of xctool, you can run this:

before_install:
  - brew update
  - brew outdated xctool || brew upgrade xctool

File System

VMs running OS X use the default file system, HFS+. This file system is case-insensitive, and returns entities within a directory alphabetically.

JDK and OS X

The JDK available in the OS X environment is tied to the Xcode version selected for your build, it is not set independently. To use a particular JDK for your build, be sure to select an OS X image which includes the version of Java that you need.

Compilers and Build toolchain

  • apple-gcc42
  • autoconf 2.69
  • automake 1.14
  • maven 3.2
  • mercurial 2.9
  • pkg-config 0.28
  • subversion 1.8.10
  • wget 1.15
  • xctool 0.2.1
  • cmake

Languages

  • go 1.3.1

Services

  • postgis 2.1.3
  • postgresql 9.3.5

Runtimes

Every worker has at least one version of Ruby, Java and Python to accommodate projects that may need one of those runtimes during the build.

Environment variables

  • CI=true
  • TRAVIS=true
  • USER=travis (do not depend on this value)
  • HOME=/Users/travis (do not depend on this value)

Additionally, Travis CI sets environment variables you can use in your build, e.g. to tag the build, or to run post-build deployments.

  • TRAVIS_BRANCH:For builds not triggered by a pull request this is the name of the branch currently being built; whereas for builds triggered by a pull request this is the name of the branch targeted by the pull request (in many cases this will be master).
  • TRAVIS_BUILD_DIR: The absolute path to the directory where the repository being built has been copied on the worker.
  • TRAVIS_BUILD_ID: The id of the current build that Travis CI uses internally.
  • TRAVIS_BUILD_NUMBER: The number of the current build (for example, “4”).
  • TRAVIS_COMMIT: The commit that the current build is testing.
  • TRAVIS_COMMIT_RANGE: The range of commits that were included in the push or pull request. (Note that this is empty for builds triggered by the initial commit of a new branch.)
  • TRAVIS_JOB_ID: The id of the current job that Travis CI uses internally.
  • TRAVIS_JOB_NUMBER: The number of the current job (for example, “4.1”).
  • TRAVIS_PULL_REQUEST: The pull request number if the current job is a pull request, “false” if it’s not a pull request.
  • TRAVIS_SECURE_ENV_VARS: Whether or not secure environment vars are being used. This value is either “true” or “false”.
  • TRAVIS_REPO_SLUG: The slug (in form: owner_name/repo_name) of the repository currently being built. (for example, “travis-ci/travis-build”).
  • TRAVIS_OS_NAME: On multi-OS builds, this value indicates the platform the job is running on. Values are linux and osx currently, to be extended in the future.
  • TRAVIS_TAG: If the current build is for a git tag, this variable is set to the tag’s name.

Maven version

Stock Apache Maven 3.

Ruby versions/implementations

  • system (depends on OS X version) – You need to use sudo to install gems with this ruby
  • 1.9.3
  • 2.0.0 (default)
  • 2.1.5
  • 2.2.1

Rubies are built using RVM that is installed per-user.

Bundler version

Recent 1.7 version (usually the most recent)

Gems in the global gem set

  • bundler
  • rake
  • cocoapods

Xcode version

Xcode 6.1 is installed with the iOS 7.0, 7.1 and 8.1 simulators and SDKs. Command Line Tools are also installed.

Xcode 8

Xcode 8gm is available by adding osx_image: xcode8 to your .travis.yml.

Our Xcode 8gm images have the following SDKs preinstalled:

  • macosx10.11
  • iphoneos10.0
  • iphonesimulator10.0
  • appletvos10.0
  • appletvsimulator10.0
  • watchos3.0
  • watchsimulator3.0
  • iphoneos9.3
  • iphonesimulator9.3
  • appletvos9.2
  • appletvsimulator9.2
  • watchos2.2
  • watchsimulator2.2

The Xcode 8gm image also comes with the following simulators:

  • iOS 10.0
  • watchOS 3.0
  • tvOS 10.0
  • iOS 8.1
  • iOS 8.2
  • iOS 8.3
  • iOS 8.4
  • iOS 9.0
  • iOS 9.1
  • iOS 9.2
  • iOS 9.3
  • watchOS 2.0
  • watchOS 2.1
  • watchOS 2.2
  • tvOS 9.0
  • tvOS 9.1
  • tvOS 9.2

Xcode 7.3

Xcode 7.3.1 is available by adding osx_image: xcode7.3 to your .travis.yml.

Our Xcode 7.3.1 images have the following SDKs preinstalled:

  • macosx10.11
  • iphoneos9.3
  • iphonesimulator9.3
  • appletvos9.2
  • appletvsimulator9.2
  • watchos2.2
  • watchsimulator2.2

The Xcode 7.3.1 image also comes with the following simulators:

  • iOS 8.1
  • iOS 8.2
  • iOS 8.3
  • iOS 8.4
  • iOS 9.0
  • iOS 9.1
  • iOS 9.2
  • iOS 9.3
  • watchOS 2.0
  • watchOS 2.1
  • watchOS 2.2
  • tvOS 9.0
  • tvOS 9.1
  • tvOS 9.2

Xcode 7.2

Xcode 7.2.1 is available by adding osx_image: xcode7.2 to your .travis.yml.

Please note that this is our first image based on OS X 10.11.

Our Xcode 7.2.1 images have the following SDKs preinstalled:

  • macosx10.11
  • iphoneos9.2
  • iphoneos9.1
  • iphonesimulator9.2
  • iphonesimulator9.1
  • tvos9.0
  • appletvsimulator9.0
  • watchos2.0
  • watchsimulator2.0

The Xcode 7.2.1 image also comes with the following simulators:

  • iOS 8.1
  • iOS 8.2
  • iOS 8.3
  • iOS 8.4
  • iOS 9.0
  • iOS 9.1
  • watchOS 2.0
  • tvOS 9.0

Xcode 7.1

Xcode 7.1.1 GM is available by adding osx_image: xcode7.1 to your .travis.yml.

Our Xcode 7.1.1 GM images have the following SDKs preinstalled:

  • macosx10.11
  • iphoneos9.1
  • iphonesimulator9.1
  • tvos9.0
  • appletvsimulator9.0
  • watchos2.0
  • watchsimulator2.0

The Xcode 7.1.1 GM image also comes with the following simulators:

  • iOS 8.1
  • iOS 8.2
  • iOS 8.3
  • iOS 8.4
  • iOS 9.0
  • iOS 9.1
  • watchOS 2.0
  • tvOS 9.0

Xcode 7

Xcode is available by adding osx_image: xcode7 to your .travis.yml.

Our Xcode images have the following SDKs preinstalled:

  • macosx10.11
  • iphoneos9.0
  • iphonesimulator9.0
  • watchos2.0
  • watchsimulator2.0

The Xcode image also comes with the following simulators:

  • iOS 8.1
  • iOS 8.2
  • iOS 8.3
  • iOS 8.4
  • iOS 9.0
  • watchOS 2.0

Xcode 6.4

Xcode is available by adding osx_image: xcode6.4 to your .travis.yml.

Our Xcode images have the following SDKs preinstalled:

  • macosx10.9
  • macosx10.10
  • iphoneos8.4
  • iphonesimulator8.4

The Xcode image also comes with the following simulators:

Xcode 6.3

Xcode is available by adding osx_image: beta-xcode6.3 to your .travis.yml.

Our Xcode images have the following SDKs preinstalled:

  • macosx10.9
  • macosx10.10
  • iphoneos8.3
  • iphonesimulator8.3

The Xcode image also comes with the following simulators:

  • iOS 7.1
  • iOS 8.1
  • iOS 8.2
  • iOS 8.3

Xcode 6.2

Xcode is available by adding osx_image: beta-xcode6.2 to your .travis.yml.

Our Xcode images have the following SDKs preinstalled:

  • macosx10.9
  • macosx10.10
  • iphoneos8.2
  • iphonesimulator8.2

The Xcode image also comes with the following simulators:

  • iOS 7.1
  • iOS 8.1
  • iOS 8.2

Xcode 6.1

Xcode is available by adding osx_image: beta-xcode6.1 to your .travis.yml.

Default when no other osx_image: is specified

Our Xcode images have the following SDKs preinstalled:

  • macosx10.9
  • macosx10.10
  • iphoneos8.1
  • iphonesimulator7.0
  • iphonesimulator7.1
  • iphonesimulator8.1

The Xcode image also comes with the following simulators:

  • iOS 7.0
  • iOS 7.1
  • iOS 8.1