Skip to content

Install Bats Using a Package

Kondwani Kamundi edited this page Aug 10, 2022 · 19 revisions

Purpose

You may be able to find 🦇 Bats pre-packaged for your operating system or distribution. If available, such a package may offer a convenient alternative to cloning the Github repository:

  • The installation is usually shared by all users on the system.
  • The bats command will typically be available without configuration of any kind.
  • Updates and bug fixes may be provided via the regular stream of package updates for your system.

Table of Contents

⭕️ Ubuntu

⚠️ Caution: This repository 📦 distributes sstephenson bats v0.4.0 🐼
See node/npm option below

sudo add-apt-repository ppa:duggan/bats
sudo apt-get update
sudo apt-get install bats
  • TODO: ☎️ make contact with @duggan and/or @neurodebian and get the current bats-core packaged 📦 .

🤠 Fedora

sudo dnf install bats

🦎 openSUSE

Bats is available for openSUSE Tumbleweed, as well as for openSUSE Leap 42.1 and later releases:

zypper install bats

For older releases, take a look at the development project on OBS (Open Build Service). You may find a repository containing a package for your target release, or build your own package using the sources found there.

🐧 Arch Linux

⚠️ Caution: The community repository 📦 distributes sstephenson bats v0.4.0

Bats is available for Arch Linux via AUR using your favourite AUR helper.

pacaur -Sa bats-core

🗻 Alpine Linux

To install the old, sstephenson bats

# coreutils is needed because busybox `readlink` is not supported by BATS
sudo apk add coreutils bats
sudo apk add ncurses # Needed to support 'pretty' output

to install the newer bats-core

sudo apk add coreutils ncurses
curl -#L https://github.com/bats-core/bats-core/archive/master.zip | unzip -
sudo bash bats-core-master/install.sh /usr/local
rm -rf ./bats-core-master

🍎 Mac OSX

Bats is available for Mac OSX using brew. If you don’t have brew already, discover and install it from here.

brew install bats-core

Installation with npm

You can install the bats-core npm package globally with:

$ npm install -g bats

Installation with bpkg

$ bpkg install -g bats-core/bats-core

Installation with Basher

basher install bats-core/bats-core

Which installs the GIT master version. To be able to check out other versions, add this before the command: BASHER_FULL_CLONE=true


Table of Contents partially generated with markdown-toc