Cyberithub

How to Install yq command line tool on macOS(Monterey 12)

Advertisements

In this article, we will see how to install yq command line tool on macOS(Monterey 12). yq is a free and open source command line tool for YAML/XML file processing. It requires jq to be preinstalled in the System. It doesn't yet support everything jq does - but it does support the most common operations and functions, and more is being added continuously.

yq package include executable packages like xq and tomlq. xq transcodes XML to JSON using xmltodict and pipes it to jq and tomlq uses the toml library to transcode TOML to JSON, then pipes it to jq. yq processor can be easily installed on Linux and macOS based Systems. Here we will see the steps to install yq command line tool on macOS(Monterey 12).

Advertisements

How to Install yq command line tool on macOS(Monterey 12)

How to Install yq command line tool on macOS(Monterey 12)

Also Read: How to Install Jsonnet on macOS(Monterey 12) Using brew

Since yq has dependency on jq so you need to first install jq package by using brew install jq command as shown below.

Advertisements
cyberithub@n1ams2p9089 ~ % brew install jq
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).

You have 2 outdated formulae installed. 
You can upgrade them with brew upgrade 
or list them with brew outdated.

==> Downloading https://ghcr.io/v2/homebrew/core/oniguruma/manifests/6.9.8
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/oniguruma/blobs/sha256:960657e546b0dec7653e879db8b31a6789fdb07123b6adb
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:960657e546b0dec7653e879db8b31a6789fdb07123b6adb?se=2022-09-28T15%3A35%3A00Z&sig=Car1GptU0EEgA
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jq/manifests/1.6-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:8deef541090b10a879bef54108bcd713497bc654de5676f675bc126eef0
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:8deef541090b10a879bef54108bcd713497bc654de5676f675bc126eef0?se=2022-09-28T15%3A35%3A00Z&sig=nVcxiCohGjjj1
######################################################################## 100.0%
==> Installing dependencies for jq: oniguruma
==> Installing jq dependency: oniguruma
==> Pouring oniguruma--6.9.8.monterey.bottle.tar.gz
    /usr/local/Cellar/oniguruma/6.9.8: 14 files, 1.4MB
==> Installing jq
==> Pouring jq--1.6.monterey.bottle.1.tar.gz
    /usr/local/Cellar/jq/1.6: 18 files, 1.1MB
==> Running `brew cleanup jq`...
Disable this behavior by setting HOMEBREW_NO_INSTALL_CLEANUP. 
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

Next step is to install yq command line tool using brew install yq command as shown below.

cyberithub@n1ams2p9089 ~ % brew install yq
Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).

You have 2 outdated formulae installed.
You can upgrade them with brew upgrade
or list them with brew outdated

==> Downloading https://ghcr.io/v2/homebrew/core/yq/manifests/4.27.5
##################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/yq/blobs/sha256:6ed8bac8deaac78aeaa897a89ae454a8342aed45c464
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:6ed8bac8deaac78aeaa897a89ae454a8342aed45c464?se=2022-09-12T16%3A20%3A00Z&sig=MR01J48EK52
##################################################################### 100.0%
==> Pouring yq--4.27.5.monterey.bottle.tar.gz
==> Caveats
zsh completions have been installed to:
    /usr/local/share/zsh/site-functions
==> Summary
    /usr/local/Cellar/yq/4.27.5: 9 files, 9MB
==> Running `brew cleanup yq`...
Disable this behavior by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

After successful installation, you can verify the yq command version by using yq --version command as shown below.

Advertisements
cyberithub@n1ams2p9089 ~ % yq --version
yq (https://github.com/mikefarah/yq/) version 4.27.5

Once you are done with yq utility then you can choose to uninstall by using brew uninstall yq command as shown below.

cyberithub@n1ams2p9089 ~ % brew uninstall yq
Uninstalling /usr/local/Cellar/yq/4.27.5... (9 files, 9MB)

Leave a Comment