Skip to content

Instantly share code, notes, and snippets.

Last active January 12, 2016 04:32
Show Gist options
  • Save DQNEO/67442bbe0c60f3220595 to your computer and use it in GitHub Desktop.
Save DQNEO/67442bbe0c60f3220595 to your computer and use it in GitHub Desktop.
How to Install Berkshelf version3 on Cygwin 64bit

How to Install Berkshelf version3 on Cygwin 64bit

Installation of Berkshelf v3 on Cygwin is known to be very diffcult, but I have finally found the way. 😄

You can successfully install it by following the procedure below.

(As at 2014/6/8, v3.1.3 is available)

Why is it so difficult ?

Among the gems on which Berkshelf depends, there are two gems that are difficult to install:

  • ffi
  • dep-selector-libgecode

In other words, if you can install just these two gems, you should be able to install Berkshelf.

So Let’s give it a try!

Target Environment

Cygwin 64bit

(I used Windows 7, but believe it will also work on Windows 8)


Install the following:

  • apt-cyg
  • rbenv , ruby version 2.1

install apt-cyg

Put this file in a directory of your $PATH

e.g. C:\cygwin64\usr\local\bin\apt-cyg.

and set it executable

chmod 0755 /usr/local/bin/apt-cyg

install rbenv, ruby 2.1

Install required packages using apt-cyg

$ apt-cyg install git gcc-core  gcc-g++ make zlib-devel curl \
autoconf  libiconv libiconv-devel rsync patch unzip openssh openssl-\
devel libxml2-devel libxslt-devel  libffi-devel libgdbm-devel

Install rbenv and ruby-build

This follows the official manual.

git clone git:// ~/.rbenv
git clone git:// ~/.rbenv/plugins/ruby-build

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc

$SHELL --login

rbenv install 2.1.0-rc1
rbenv global 2.1.0-rc1
rbenv rehash

That’s it!


$ ruby -v
ruby 2.1.0dev (2013-12-20 trunk 44301) [x86_64-cygwin]

Installing ffi

ffi/ffi#284 (comment)

You can install ffi per the above comment from RSmirnov:

$ apt-cyg install libffi6 libffi-devel pkg-config
$ export PKG_CONFIG_PATH="/lib/pkgconfig"
$ gem install ffi

Installing dep-selector-libgecode

# Create symlinks to gcc48.exe, g++48.exe
$ ln -s gcc.exe /usr/bin/gcc48.exe
$ ln -s g++.exe /usr/bin/g++48.exe

# Download and unzip gecode 3.7.3
$ wget ""
$ tar xvfz gecode-3.7.3.tar.gz
$ cd gecode-3.7.3

# Compile
$ ./configure CC="gcc48"  --disable-doc-dot --disable-doc-search --disable-doc-tagfile --disable-doc-chm --disable-doc-docset --disable-qt --disable-examples --disable-flatzinc
$ make
$ make install
# Manually install the libraries
$ cp libgecode* /lib/
$ cp -r gecode/* /usr/include/


Finally, install Berkshelf !

$ USE_SYSTEM_GECODE=1 gem install berkshelf


$ berks --version
DL is deprecated, please use Fiddle

Did it work?


This document is originally writen in Qiita by Japansese.

English Translation was made by J.Z.

I’d like to express my profound gratitude to all those whose work made this possible.

Copy link

adamd1 commented Sep 24, 2015

The setup of rbenv consistently fails. Following that, none of the other steps work either.

This is way too complicated and renders the entire process unworkable outside of a pure unix environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment