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. 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

  1. Open your app on Bitrise.

  2. Go to the Workflow tab.

  3. Select a Workflow from the WORKFLOW dropdown menu.

    Installing any additional tools
  4. Click the + sign to insert a Step at that position from our Step Library.

  5. In the Search steps bar, search for “script” and click on the Script Step . This will add the Step to your Workflow.

  6. Click the Step in your Workflow.

  7. Insert your script into the Script content input field.

    Running a script from your repository

    If you want to run a script from your repository, you can run it from this Script Step. Paths are relative to your repository’s root. For example, if you have a Bash script at path/to/script.sh you can add it to the Script content input field and run it with the following command:

    #!/bin/bash
    set -ex
    bash ./path/to/script.sh

    You can run non-Bash scripts too, for example, a Ruby script:

    #!/bin/bash
    set -ex
    ruby ./path/to/script.rb
Example 1. Installing cmake on macOS

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.


Example 2. Installing cmake on Linux

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.


Installing tools by declaring deps in the bitrise.yml file

Instead of installing a dependency or tool using a dependency installer Step or Script Step, you can also use the deps option of the bitrise.yml. 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.

  1. Open your app on Bitrise.

  2. Go to the Workflow tab.

  3. Go to the bitrise.yml tab.

  4. Find the Step you need: you will declare the dependencies for that Step.

  5. Add deps below the Step title:

    workflows:
      test:
        steps:
        - script:
            deps:
  6. 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