diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb
index <HASH>..<HASH> 100644
--- a/ext/psych/extconf.rb
+++ b/ext/psych/extconf.rb
@@ -7,7 +7,7 @@ require 'fileutils'
 
 dir_config 'libyaml'
 
-if enable_config("bundled-libyaml", false) || !(find_header('yaml.h') && find_library('yaml', 'yaml_get_version'))
+if enable_config("bundled-libyaml", false) || !pkg_config('yaml-0.1') && !(find_header('yaml.h') && find_library('yaml', 'yaml_get_version'))
   # Embed libyaml since we could not find it.
 
   $VPATH << "$(srcdir)/yaml"
Added condition for macOS homebrew