xcodes

Make sure a certain version of Xcode is installed, installing it only if needed

Makes sure a specific version of Xcode is installed. If that's not the case, it will automatically be downloaded by xcodes.
This will make sure to use the correct Xcode version for later actions.
Note that this action depends on xcodes CLI, so make sure you have it installed in your environment. For the installation guide, see: https://github.com/RobotsAndPencils/xcodes#installation

xcodes
Supported platforms ios, mac
Author @rogerluan
Returns The path to the newly installed Xcode version

2 Examples

xcodes(version: "14.1")
xcodes # When missing, the version value defaults to the value specified in the .xcode-version file

Parameters

Key Description Default
version The version number of the version of Xcode to install. Defaults to the value specified in the .xcode-version file *
update_list Whether the list of available Xcode versions should be updated before running the install command true
select_for_current_build_only When true, it won't attempt to install an Xcode version, just find the installed Xcode version that best matches the passed version argument, and select it for the current build steps. It doesn't change the global Xcode version (e.g. via 'xcrun xcode-select'), which would require sudo permissions — when this option is true, this action doesn't require sudo permissions false
binary_path Where the xcodes binary lives on your system (full path) *
xcodes_args Pass in xcodes command line arguments directly. When present, other parameters are ignored and only this parameter is used to build the command to be executed

* = default value is dependent on the user's system


Lane Variables

Actions can communicate with each other using a shared hash lane_context, that can be accessed in other actions, plugins or your lanes: lane_context[SharedValues:XYZ]. The xcodes action generates the following Lane Variables:

SharedValue Description
SharedValues::XCODES_XCODE_PATH The path to the newly installed Xcode version

To get more information check the Lanes documentation.


Documentation

To show the documentation in your terminal, run

fastlane action xcodes

CLI

It is recommended to add the above action into your Fastfile, however sometimes you might want to run one-offs. To do so, you can run the following command from your terminal

fastlane run xcodes

To pass parameters, make use of the : symbol, for example

fastlane run xcodes parameter1:"value1" parameter2:"value2"

It's important to note that the CLI supports primitive types like integers, floats, booleans, and strings. Arrays can be passed as a comma delimited string (e.g. param:"1,2,3"). Hashes are not currently supported.

It is recommended to add all fastlane actions you use to your Fastfile.


Source code

This action, just like the rest of fastlane, is fully open source, view the source code on GitHub


Back to actions