-
Notifications
You must be signed in to change notification settings - Fork 0
Installing psych on Windows
Instructions are based on http://jonforums.github.com/ruby/2012/02/24/hacking-a-gem.html.
-
Download the Ruby Development Kit from http://rubyinstaller.org/downloads/
-
Double click the DevKit installer you just downloaded and type
c:\devkit
in the popup box. -
Open up the Command Prompt and do the following:
cd c:\devkit ruby dk.rb init ruby dk.rb install
-
Confirm your Ruby environment is correctly using the DevKit by running
gem install rdiscount --platform=ruby
. RDiscount should install correctly and you should seeTemporarily enhancing PATH to include DevKit…
in the screen messages -
Run
ruby -rubygems -e "require 'rdiscount'; puts RDiscount.new('**Hello RubyInstaller**').to_html"
to confirmrediscount
is working. You should see<p><strong>Hello RubyInstaller</strong></p>
. -
Download
libyaml
artifacts from https://github.com/jonforums/libyaml-waf/downloads (backup) and extract them intoc:\devlibs\libyaml
. Be careful with WinZip! If you drag/drop it will flatten out the directory structure and this won't work. Use 7zip instead. (For x64, try http://packages.openknapsack.org/libyaml/libyaml-0.1.4-x64-windows.tar.lzma instead)
Ok, now you're ready to modify the psych
gem. There are two ways to do this: follow these instructions or download this file. The latter option is way easier but isn't maintainable, so you'll be stuck on v1.2.2 if you use it.
Either way, you should end up with a file called psych-1.2.3.alpha.1.gem
. In the Command Prompt, cd into the same folder as this file and run the following command:
gem install psych-1.2.3.alpha.1.gem -- --with-libyaml-dir=c:\devlibs\libyaml --enable-static
You should see:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed psych-1.2.3.alpha.1
1 gem installed
You can test this by running the following:
ruby -e 'require "rubygems"; require "psych"; require "pp"; pp Psych.load %Q[- this\n- is\n- an array\n- of strings]'
You should see:
["this", "is", "an array", "of strings"]