Completing Appium Setup: Installing Optional Dependencies on macOS

Completing Appium Setup: Installing Optional Dependencies on macOS

5 April 2024 Stephan Petzl Leave a comment Tech-Help

When working with Appium on macOS, you might encounter a situation where certain optional dependencies are missing. These dependencies are crucial for a seamless Appium experience. Today, we’ll walk through the steps to install two of these: opencv4nodejs and bundletool.jar.

Installing opencv4nodejs

To install the opencv4nodejs package, you can use the following command:

npm -g install opencv4nodejs

This installation might require additional dependencies. If you encounter any issues, ensure you have ‘make’ installed on your system. You can install ‘make’ using Homebrew:

brew install make

In some cases, particularly on MacOS Catalina (10.15.1), you may face issues with building opencv4nodejs due to C++ 11 features compatibility. To address this, install OpenCV using Homebrew with the following command:

brew install opencv@4

Then, set an environment variable to prevent auto-building of OpenCV:

export OPENCV4NODEJS_DISABLE_AUTOBUILD=1

After setting the variable, proceed to install opencv4nodejs using the npm command mentioned earlier.

Setting up bundletool.jar

The bundletool.jar is a tool provided by Google to work with Android App Bundles. Follow these steps to set it up:

  1. Download bundletool-all-0.8.0.jar from the official Bundletool releases page.
  2. Rename the downloaded file to bundletool.jar and place it in a dedicated sub-folder within your Android SDK directory, like so: /Users/{USER}/Library/Developer/Android/sdk/bundle-tool.
  3. Make the bundletool.jar file executable by running the following command in your terminal:
  4. chmod +x bundletool.jar
  5. Add the bundle-tool folder to your system’s PATH variable. Edit your ~/.bashrc file and append the following line:
  6. PATH="$PATH:$ANDROID_HOME/bundle-tool"

After completing these steps, verify the setup by running which bundletool.jar in your terminal. If correctly set up, it should point to the folder you created.

Finalizing the Setup

With both opencv4nodejs and bundletool.jar installed and set up, running appium-doctor should now show that all dependencies are satisfied, ensuring a fully functional Appium environment.

By following these instructions, you can resolve common issues related to the optional dependencies for Appium on macOS. This will help you maintain an optimally functioning development environment for your mobile application testing and development.

Like this article? there’s more where that came from!