The fastest way to get up and running with Merb is to install with RubyGems. Make sure you have the dev version of ruby installed (sudo apt-get install ruby1.8-dev if you're using apt), an updated version of RubyGems (>= 1.3.0) and the hoe (>= 1.8.0) gem, and run the following:
$ sudo gem install merb
The gem command will output its progress while it sucks down and installs all the necessary gems for a full Merb install.
To install Merb with all of its development and testing dependency gems run:
$ sudo gem install merb --development
If you run into any problems with installing the gems please do the following before reporting an issue:
$ sudo gem update --system $ gem search --no-version merb | grep merb | xargs sudo gem uninstall -a # NOTE: this removes all old version of merb $ gem search --no-version dm | grep dm | xargs sudo gem uninstall -a # NOTE: this removes all old version of data_mapper $ gem search --no-version data_objects | grep data_objects | xargs sudo gem uninstall -a # NOTE: this removes all old version of data_objects $ sudo gem sources -c $ sudo rm PATH_TO_GEMS/cache/merb* # PATH_TO_GEMS is the path to your rubygems install. Mine is /opt/local/lib/ruby/gems/1.8 others have /usr/lib/ruby/gems/1.8 $ sudo rm PATH_TO_GEMS/cache/dm* $ sudo gem install -r merb
This especially works if you're getting this error
ERROR: Error installing merb:
merb-more requires merb-builder (>= 0.9.9, <= 1.0, runtime)
There is a problem with Ubuntu (at least with mine) - merb is installed here /var/lib/gems/1.8/gems/merb-0.9.9/lib/merb.rb instead of /usr/lib.
The solution is to install rubygems from source:
mkdir ~/sources cd ~/sources wget http://rubyforge.org/frs/download.php/43985/rubygems-1.3.0.tgz tar vzfx rubygems-1.3.0.tgz cd rubygems-1.3.0 sudo ruby setup.rb cd /usr/bin/ sudo ln -s gem1.8 /usr/bin/gem gem -v #verify that you got version 1.3.0 sudo gem update sudo gem update --system #I got an error here, but I ignored it sudo gem install rdoc #this is a merb dependency sudo gem install merb
If upgrading rubygems from 1.2 (possibly any earlier 1.x version) to 1.3.1, there is a bug where rubygems just says “Nothing to update”. In that case, do the following:
sudo gem install rubygems-update sudo update_rubygems
…and that should fix the update issue.
One other problem that can show up on Ubuntu (and probably other debian derivatives as well) is that webrat installation fails, which is caused by the system not being able to find libxml2 when installing nokogiri.
To fix this, make sure to have libxslt-dev, libxml-ruby, libxslt-ruby installed, and then it should work.
The gem 'rubyforge' is required to install nokogiri as well.
In Fedora 9 & 10, you may need to install development headers for ruby and/or sqlite before installing merb:
$ sudo yum install ruby-devel sqlite-devel
… and the development tools group if you don't already have gcc, make, libraries, etc:
$ sudo yum groupinstall development-tools
… and mongrel
$ sudo yum install rubygem-mongrel
… and the “launchy” gem:
$ gem install launchy
In Ubuntu, if you are receiving the following error:
ERROR: Error installing merb: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb install merb checking for sqlite3.h... no *** extconf.rb failed ***
$ sudo apt-get install libsqlite3-dev
While installing do_mysql gem on Ubuntu, if you are receiving the following error:
Building native extensions. This could take a while... ERROR: Error installing do_mysql: ERROR: Failed to build gem native extension. /usr/bin/ruby1.8 extconf.rb install do_mysql checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed ***
sudo apt-get install libmysqlclient15-dev
Some people have been reporting empty replies after upgrading to 1.0. One solution seems to be reinstalling ParseTree (See this post for more information: http://www.pastbedti.me/2008/11/merb-10-and-empty-reply-from-server/