diff --git a/lib/knife-solo/bootstraps/darwin.rb b/lib/knife-solo/bootstraps/darwin.rb index 5d8170d4..c80cc392 100644 --- a/lib/knife-solo/bootstraps/darwin.rb +++ b/lib/knife-solo/bootstraps/darwin.rb @@ -7,11 +7,22 @@ def issue def distro case issue - when %r{10.(?:[6-9]|10)} + when %r{10.(?:[6-9]|1[0-2])} {:type => 'omnibus'} else raise "OS X version #{issue} not supported" end end + + def bootstrap! + super + if issue.split('.')[1].to_i >= 11 + # El Capitan and beyond do not have /usr/local/bin in the default paths, + # which is where chef gets installed. + path = "/usr/local/bin" + path_command = "[[ $PATH == *#{path}* ]] || echo 'export PATH=#{path}:$PATH' >> ~/.bashrc" + run_command(path_command) + end + end end end diff --git a/lib/knife-solo/resources/solo.rb.erb b/lib/knife-solo/resources/solo.rb.erb index 7b85df17..5beada85 100644 --- a/lib/knife-solo/resources/solo.rb.erb +++ b/lib/knife-solo/resources/solo.rb.erb @@ -19,3 +19,7 @@ cookbook_path << File.join(base, 'cookbooks-<%= i+1 %>') # <%= path %> <% proxy_settings.each_pair do |k, v| -%> <%= k %> "<%= v %>" <% end -%> + +# If the TMPDIR is not world-readable, set it to a location that is. This is +# necessary so that `script` resources can complete as non-root users on macOS. +ENV['TMPDIR'] = "/tmp"