Bear has been around for a while, and packages are available in many distributions. For an easy installation, check your machine's package manager for available packages. These packages are well-tested and should be your first choice for installation.
Bear is now implemented in Rust and can be built and installed using the Rust toolchain.
Rust toolchain: Install Rust using rustup.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shEnsure cargo and rustc are available in your PATH:
rustc --version
cargo --versionTo build and install Bear, run the following commands:
-
Clone the repository:
git clone https://github.com/rizsotto/Bear.git cd bear -
Build:
cargo build --release
-
Install:
sudo mkdir -p /usr/local/libexec/bear sudo mkdir -p /usr/local/man/man1 sudo install -m 755 target/release/bear /usr/local/bin/ sudo install -m 755 target/release/wrapper /usr/local/libexec/bear/ sudo install -m 644 man/bear.1 /usr/local/man/man1/
To install the preload library, you need to determine the directory the dynamic
linker uses to resolve the $LIB symbol. You can find more information about
this in the ld.so man page (man ld.so).
# For RedHat, Fedora, Arch based systems
export INSTALL_LIBDIR=lib64
# For Debian based systems
export INSTALL_LIBDIR=lib/x86_64-linux-gnuThen run the following commands:
sudo mkdir -p /usr/local/libexec/bear/$INSTALL_LIBDIR
sudo install -m 755 target/release/libexec.so /usr/local/libexec/bear/$INSTALL_LIBDIR/If you are a package maintainer for a distribution, there are a few extra things you might want to know:
- The Bear executable contains hardcoded paths to the
wrapperexecutable and thelibexec.soshared library. If you change the location of these binaries, you also need to change thebear/build.rsfile where these paths are set. - Package the release build of this software. You can run the unit tests as
part of the package build. Running the integration tests requires rebuilding
the executables, so it is recommended to isolate the two steps as much as
possible. Consult the CI configuration in
.github/workflows/build_rust.ymlfor details. - The preload mode is only enabled on UNIX at the moment. Including
libexec.soonly makes sense on this OS. This might be extended to other operating systems in the future. Consultintercept-preload/build.rsfor details. - The preload library path contains a
$LIBstring, which the dynamic linker understands and resolves. This is useful in a multilib context. Consult theld.soman page (man ld.so) for details.