Installing tools during a build
If you need a tool that isn't preinstalled on the build machines and you can’t find a Step for it, you can always install and use them with scripts or Script Steps.
If you need a tool that isn't preinstalled on the build machines and you can’t find a Step for it, you can always install and use them with custom scripts. You can add a Script Step to your Workflow, and either write your script there, or run a script from your repository. Passwordless sudo
is enabled in all of our build virtual machines, so you can freely use sudo
if you need it.
Once you have a working script, you can also transform it into a Step and optionally share it with others (through our StepLib). Read more: Developing a new Step
-
Log in to Bitrise and select Bitrise CI on the left, then select your project.
-
Click the
button on the main page. -
Add a Script Step to your Workflow.
-
Insert your script into the Script content input field.
You can run a script from your repository using this Step: you just need to add the right command with the script's path, relative to the repository root.
Install cmake
with a Script
Step on macOS with the following brew
command:
#!/bin/bash set -ex brew install cmake
Brew install
You can also use the Brew install Step to install cmake
and many other tools.
Install cmake
with a Script
Step on Linux with the following apt-get
command:
#!/bin/bash set -ex sudo apt-get install -y cmake
Use the -y flag for apt-get
If you don’t add the -y
(yes) flag to the apt-get
command, apt-get
will present a prompt which you have to accept or deny manually. This is not a problem on your own Linux machine but in a CI environment you can’t provide manual input for
apt-get
. To prevent this issue, and to auto accept the prompt, just use the -y
flag, as shown in the example.
Run npm command
You can also use the Run npm command Step to install cmake
and many other tools.
Install iOS 13 runtime on Xcode 14 stacks with a Script
Step.
#!/bin/bash set -ex sudo xcodes runtimes install "iOS 13.0"
Available simulator runtimes on macOS stacks
You can install other runtimes using a similar syntax, but keep in mind, some runtimes are already preinstalled on our stacks. If you are interested in the list of preinstalled tools, such as simulator runtimes on our stacks, you can find every available stack’s System Report on GitHub.
Installing tools by declaring deps in the bitrise.yml file
Instead of installing a dependency or tool using a dependency installer Step or a Script Step, you can also use the deps
option in your configuration YAML file. If you declare deps
for a specific Step, the Bitrise CLI will check if that tool is installed, and will install it for you, if required.
If the selected tool or dependency is already available, the Bitrise CLI will not install it.
-
Log in to Bitrise and select Bitrise CI on the left, then select your project.
-
Click the
button on the main page. -
Select Configuration YAML on the left.
-
Find the Step you need: you will declare the dependencies for that Step.
-
Add
deps
below the Step title:workflows: test: steps: - script: deps:
-
Declare the package manager name and the package name.
workflows: test: steps: - script: deps: brew: - name: cmake apt_get: - name: cmake
Declaring the binary name
If you want to declare a dependency which might be available from another source (not through the package manager), then you might also want to declare the related binary name
. If the package does not match the binary name, you can declare it with bin_name
. An example is
AWS CLI, where the package name in both package managers is awscli
, but the binary itself is aws
.
workflows: test: steps: - script: deps: brew: - name: awscli bin_name: aws