qiita-markdownのインストール方法


## Qiita-Markdown gem

[qiita-markdown](https://github.com/increments/qiita-markdown)というgemがあるのを知ったので、早速インストールしてみたところ、、、

```Gemfile
gem "qiita-markdown"
```


```bash
bundle install --path .bundle

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/yuto-ogi/.rbenv/versions/2.1.2/bin/ruby extconf.rb
checking for main() in -licui18n... no
checking for main() in -licui18n... no


***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** 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.

~(中略)~

extconf failed, exit code 1

Gem files will remain installed in /Users/yuto-ogi/Work/rails/tips/.bundle/ruby/2.1.0/gems/charlock_holmes-0.7.3 for inspection.
Results logged to /Users/yuto-ogi/Work/rails/tips/.bundle/ruby/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/charlock_holmes-0.7.3/gem_make.out
An error occurred while installing charlock_holmes (0.7.3), and Bundler cannot continue.
Make sure that `gem install charlock_holmes -v '0.7.3'` succeeds before bundling.
```

エラーになりました。
*で囲われたあたりに、icu4cをインストールせよと書かれているので、やってみます。


```bash
brew install icu4c
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/icu4c-54.1.yosemite
######################################################################## 100.0%
==> Pouring icu4c-54.1.yosemite.bottle.1.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

OS X provides libicucore.dylib (but nothing else).

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/icu4c/lib
    CPPFLAGS: -I/usr/local/opt/icu4c/include

==> Summary
?  /usr/local/Cellar/icu4c/54.1: 242 files, 65M
```


すると、今度はこんなエラーが。。。


```bash
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/yuto-ogi/.rbenv/versions/2.1.2/bin/ruby extconf.rb
checking for gmake... no
checking for make... yes
checking for cmake... no
ERROR: CMake is required to build Rugged.
*** 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.

~(中略)~

extconf failed, exit code 1

Gem files will remain installed in /Users/yuto-ogi/Work/rails/tips/.bundle/ruby/2.1.0/gems/rugged-0.22.0b4 for inspection.
Results logged to /Users/yuto-ogi/Work/rails/tips/.bundle/ruby/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/rugged-0.22.0b4/gem_make.out
An error occurred while installing rugged (0.22.0b4), and Bundler cannot continue.
Make sure that `gem install rugged -v '0.22.0b4'` succeeds before bundling.
```

「CMake is required to build Rugged.」なんて書いてあるので、cmakeをインストールします.


```bash
brew install cmake
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/cmake-3.0.2.yosemit
######################################################################## 100.0%
==> Pouring cmake-3.0.2.yosemite.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/man7/cmake-buildsystem.7
/usr/local/share/man/man7 is not writable.

You can try again using:
  brew link cmake
==> Summary
?  /usr/local/Cellar/cmake/3.0.2: 1641 files, 26M
```

今度はbrew linkしろと言われています。
大人しく指示に従いましょう。

```bash
brew link cmake
Linking /usr/local/Cellar/cmake/3.0.2...
Error: Could not symlink share/man/man7/cmake-buildsystem.7
/usr/local/share/man/man7 is not writable.```
```

権限が無いと言われました。

--forceオプションを付けても駄目。

[Cmake fails to install on 10.10 due to sphinx](https://github.com/Homebrew/homebrew/issues/33276)　この辺を読みつつ、
対象のディレクトリへのアクセス権を与えます。

```bash
cd /usr/local/share/man
sudo chown -R $USER man7
```

```bash
brew link --force cmake
Linking /usr/local/Cellar/cmake/3.0.2... 26 symlinks created
```

うまくいきました！
もはやここまで来ると、最初に何がしたかったのか思い出すのに一苦労です。

そうです、bundle installしたかったのです。
改めて

```bash
bundle install --path .bundle
```


うまくいきました！！


## 環境

* MaxOSX Yosemite
* Ruby 2.1.2
* Bundler version 1.6.5