Search code examples
chef-infraknife

Using knife commands anywhere in terminal and without "bundle exec"


I recently moved to Catalina on a formatted drive. In the past I was able to run knife from any directory on my terminal.

At the moment, it only runs from the chef repo it was installed in and it only runs when I prefix it with bundle exec

Can't find any documentation on the matter and I'm not super-savvy with terminal/bash/zsh nuances - any tips would be much appreciated


Solution

  • i will advise you to keep using bundler if you care of running multiple version of chef-client, so you can update chef-client from time to time and keep things work smoothly.

    you can specify the chef-client version in the Gemfile in your project such as

    group :default do
      gem 'chef', '15.8.23'
    end
    

    you can make chef-client more streamed lined by providing chef-client a json attribute file (specifying cookbooks attribute, etc) and a client configuration (specifying chef-client settings, such as a cookbook directory, etc.) and store them in the project repository.

    otherwise, you can install chef workstation which bundles chef-client (chef infra client) or only chef infra client (make sure the desired version you need).

    see the macos installtion or use brew to tap to homebrew-chef

    brew cask install chef/chef/chef-workstation
    

    or only chef infra client

    brew cask install chef/chef/chef-infra-client