Command failed with exit code 5: bundle install error Shopify Cli CMD

update/upgrade Homebrew

brew update

brew upgrade

Install/Update Xcode Command Line Tools

sudo rm -rf /Library/Developer/CommandLineTools

xcode-select --install

By doing the above, everything worked in my environment.