Ssh – Error when using Chef on OS X: “bash: chef-solo: command not found”

bashchefmac-osxssh

I have chef installed on my local machine: Mac OS X 10.8.3

I also have chef installed on a remote server: Ubuntu 12.10 x64 Server

On the local machine, when I try to execute a command using ssh followed by "chef-solo…":

ssh root@remoteserver "chef-solo -c /var/chef/solo.rb"

I keep getting:

bash: chef-solo: command not found

I have installed chef using the instructions here: http://docs.opscode.com/install_workstation.html
I have also checked whether chef is correctly installed (both on the remote server and the local machine)

$ chef-solo -v
Chef: 11.4.0

Does the binary folder in /opt/chef/bin need to be added to the PATH variable? I have a .bash_profile in ~ but the only line in that is:

[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" # Load RVM into a shell session *as a function*

I have tried to:
export PATH="$PATH:/opt/chef/bin"

But this doesn't help.

Best Answer

Run $ which chef-solo, which will return the full path to that binary. Then use that full path in your ssh command:

$ ssh root@remoteserver "/path/to/chef-solo -c /var/chef/solo.rb"
Related Topic