Hanami (Ruby) on Ubuntu
Jul 20, 2017 · 2 min read

Hanami is a modern Ruby web framework. I’m experimenting with it right now.
Ubuntu, compared to other linux distros, or to a mac, can often require different steps when getting started with a new tool. Here is the process I followed, which got me up and running in just a few moments of work.
- Install RVM
Ruby Version Manager (RVM) is one of the easiest ways to handle Ruby versioning, stay up to date, and minimize frustration. - If you already have RVM, run
rvm get stableto make sure you’re up to date. Then runrvm cleanup allto get rid of any cruff (not strictly necessary, just useful). - For Hanami, you’ll need to be using a modern version of Ruby, 2.3.1 or higher.
You can have RVM list the Ruby versions it’s aware of by typingrvm list known. From this list you can select the version you want and install that withrvm install; at time of writing the newest stable Ruby version was 2.4.0, so I ranrvm install ruby-2.4.0.
This should also set your newly installed version of Ruby as the one that is selected to be used, but if you want to change it manually, you can runrvm use ruby-2.4.0, etc. - Now we’re ready for Hanami itself. Simply install the Hanami gem by running
gem install hanami. - You’ll also need to make sure you have your database of choice installed (sqlite, postgres, etc).
For my purposes, I ran sudo apt-get install sqlite-3 libsqlite-dev. Chances are, on Ubuntu, you can skip this step, as it will already be installed. - Create a new project with hanami’s
newcommand, e.g:hanami new myproject - The
newcommand will create a directory of the name you specified for the project; move into that directory (cd, etc), and run abundle installto make sure everything’s ready to go. This might take a few minutes. - You’re now ready! Run
bundle exec hanami serverto check out your new project being served atlocalhost:2300. - You can use Hanami’s getting started guide as a launching pad, or check out the numerous guides and resources for learning this framework.
Good luck, and have fun!
