gem install psych error
Asked Answered
B

7

12

I'm trying to bundle install a rails project but I'm stuck... when I try to run gem install psych all I get is this:

Building native extensions.  This could take a while...
ERROR:  Error installing psych:
        ERROR: Failed to build gem native extension.

        /Users/gibatronic/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
checking for yaml.h... no
yaml.h is missing. Try 'port install libyaml +universal' or 'yum install libyaml-devel'
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/gibatronic/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
    --with-libyaml-dir
    --without-libyaml-dir
    --with-libyaml-include
    --without-libyaml-include=${libyaml-dir}/include
    --with-libyaml-lib
    --without-libyaml-lib=${libyaml-dir}/lib


Gem files will remain installed in /Users/gibatronic/.rvm/gems/ruby-1.9.3-p327/gems/psych-1.3.4 for inspection.
Results logged to /Users/gibatronic/.rvm/gems/ruby-1.9.3-p327/gems/psych-1.3.4/ext/psych/gem_make.out

I'm running ruby 1.9.3p327 with rails 3.2.12 on OS X 10.8.2

I've already installed libyaml 0.1.4 with rvm pkg install libyaml

I really don't know what to do anymore!

Bellabelladonna answered 20/2, 2013 at 17:55 Comment(4)
its looking for the libyaml-devel lib, try installing that as it is suggested in the error messageCrossland
I would like to @Crossland but it seems that libyaml-devel doesn't even exists!Bellabelladonna
this just worked for me port install libyaml +universal @BellabelladonnaCrossland
yeeesssss! thanks @bernabas! I didn't knew MacPorts... now that I installed libyaml through it I could finally install pysch gem!Bellabelladonna
C
4

install libyaml

port install libyaml +universal
Crossland answered 20/2, 2013 at 22:18 Comment(0)
B
17
apt-get install libyaml-dev

did the fix in my case running under Debian 7 based systems (Likely the same for Ubuntu)

Bridewell answered 3/2, 2014 at 18:5 Comment(2)
It says it is already the newest versionPaderewski
Can't believe this fix still works almost 10 years later. Thanks!!Kipkipling
N
9

macOS:

brew install libyaml

It fixed my gem update error on trying to parse YAML step.

Numerary answered 1/2, 2023 at 21:55 Comment(0)
S
5

This worked for me:

sudo apt-get install libyaml-dev

But I don't know why? can some explain what this command does.

Stinkwood answered 19/9, 2023 at 10:6 Comment(0)
C
4

install libyaml

port install libyaml +universal
Crossland answered 20/2, 2013 at 22:18 Comment(0)
S
3

Windows:

Run Windows PowerShell as Administrator, then type the command:

gem install psych

(if you run PowerShell in administrator mode, it will not display privilege issue when installing dependencies for psych, so libyaml will be installed and the message "error: cant lock database / Could not create Makefile" will not be displayed)

Skurnik answered 8/1 at 12:43 Comment(0)
M
0

In my case I had to set the CFLAGS and LDFLAGS variables:

# ensure libyaml is installed
port install libyaml +universal

# if you like you can check the location of the installied files (especially the .h file)
# port contents libyaml

# now configure with these options
CFLAGS="-I/opt/local/include/ "  LDFLAGS="-L/opt/local/lib/" ./configure
make
sudo make install
Macaronic answered 9/1, 2014 at 12:38 Comment(0)
T
0

In macOS install libyaml library with brew

brew install libyaml

If it is not enough (my case) install psych gem with libyaml from brew

gem install psych -- --with-libyaml-dir=$(brew --prefix libyaml)
Tinsley answered 14/5 at 1:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.