YAML safe loading is not available

Morteza QorbanAlizade picture Morteza QorbanAlizade · Oct 24, 2017 · Viewed 22.4k times · Source

When I want to install compass with gem install compass, I occurred with this error:

YAML safe loading is not available. 
Please upgrade psych to a version that supports safe loading (>= 2.0).

what The cause of this error and how can I solve the problem?

Answer

Scott Newson picture Scott Newson · Oct 26, 2017

It sounds like the psych gem needs to be updated. Try running gem install psych and then gem update psych.

Suggested by looking at the psych readme file here: https://github.com/ruby/psych/blob/master/README.md

EDIT: you might also have to update your version of ruby. This depends on how you have installed ruby, but @ewerx has one suggestion in their answer.