次の勉強会でmongodb2.2が必要ということで新規にインストールし直しました。

$ brew search mongo
で確認すると
mongodb mongoose
やら出てきましたが、取り急ぎ
$ brew install mongodb
でインストール

すらずらと出てきましたが終わった模様。
To have launchd start mongodb at login:
ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
Then to load mongodb now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Or, if you don't want/need launchctl, you can just run:
mongod
/usr/local/Cellar/mongodb/2.2.2-x86_64: 20 files, 170M, built in 8.8 minutes

成功したら、
上記のメッセージの通りシンボリックリンクを追加
$ ln -s /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents/
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
$ mongod

と必要なコマンドを入力。

$ mongo -version
$ MongoDB shell version: 2.2.2

うまくいきました。


MongoDBイン・アクション/オライリージャパン

¥3,570
Amazon.co.jp

普通にmysql連携のアプリを作ろうとしたところ
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require': dlopen(/usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Reason: image not found - /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:66:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler/runtime.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.5/lib/bundler.rb:119:in `require'
from /Users/liszt26/Documents/rails/mysqlApp/config/application.rb:7:in `'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in '
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.8/lib/rails/commands.rb:50:in `'
from script/rails:6:in `require'
from script/rails:6:in `
'




シンボルを追加すればOKでした。
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

世界の天才さん、ありがとうございました。


RailsによるアジャイルWebアプリケーション開発 第4版/オーム社

¥3,360
Amazon.co.jp

新しくAPIプロジェクトを作成することになって新マシンにてプロジェクト作成してみたところ、

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

/usr/local/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for mysql_query() in -lmysqlclient... yes
checking for mysql.h... no
checking for mysql/mysql.h... yes
checking for errmsg.h... no
-----
errmsg.h is missing. please check your installation of mysql and try again.
-----
*** 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=/usr/local/bin/ruby
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.2.3/ext/mysql2/gem_make.out

とのエラー。

mysql.hのPATHが不明らしいので明示的に示してあげるとクリアできました。

gem install mysql2 -- --with-mysql-include=/usr/include/mysql

一瞬ヒヤっとしましたがなんとか撃破。

Rail Magazine (レイル・マガジン) 2013年 02月号 Vol.353/ネコ・パブリッシング

¥1,500
Amazon.co.jp

CocoaPodsのセッティングをまとめてみました。
対応ライブラリもかなり増えてますのでこの機会に使い始めてみると面白いかもしれません。

$ sudo macgem install cocoapods
$ pod setup
$ pod --help
→ 動作確認

XCodeプロジェクト作成
XCodeプロジェクト配下に
Podfile
のファイルを作成
ファイル内に
platform :ios
pod 'TapkuLibrary'

のような形でインポートしたいライブラリを記載する。

後は
$ pod install
でxcworkspaceが生成されるので中に入りプロジェクトを起動するだけ。

意外とあっさりとインクルードできました。


初めてのRuby/オライリージャパン

¥2,310
Amazon.co.jp