Skip to content

Novice Setup Guide for Mac

Dominik Sander edited this page Oct 8, 2016 · 4 revisions

Novice Setup Guide for Mac

Written by a Ruby novice for those who are clueless during set up as well. These instructions have been modified for Mac. See the original Linux version here

Step 1 - Clone the repository

Since you are on GitHub, you have probably done this step a thousand times before.

Verify you have git installed on your machine, go to a directory where you would like to work, and clone the repository.

git clone git://github.com/cantino/huginn.git

Troubleshooting

If you fail to clone the repository because of environment issue to block git protocol, retry it again after '.gitconfig in your home folder' is changed

[url "https://github.com"]
      insteadof = git://github.com

Step 2 - Install ruby and gem

Install ruby (2.2.x or 2.3.x) and gem. You can either download them and compile manually or install via your OS' package manager (e.g. homebrew for Mac OS X or apt for Ubuntu). We recommend using rvm or rbenv. You will also need MySQL or Postgres, both of which can also be installed via your package manager.

Step 3 - Install rake and bundler

Now that we have gem installed, we can install rake, the ruby build utility, and bundler, the ruby gem dependency manager. You shouldn't need to do this step if you're using rvm or rbenv.

gem install rake bundler

Step 4 - Install local dependencies

As mentioned, bundler helps to manage dependencies. Verify you are in the cloned huginn directory. Run bundle to install Huginn's dependencies.

bundle

Troubleshooting

mysql2

If you receive an error like the one below, you have failed to install the mysql2 gem. Continue reading after the error message.

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

        /usr/bin/ruby1.9.1 extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***

You must install the proper dependencies for mysql2. If you are on a Mac OS X and use Homebrew, mysql is a dependency and should be installed:

brew install mysql
brew update

Once you have installed the dependencies, you can install mysql2 individually via gem install mysql2. After it installs, re-run bundle.

Step 5 - Install and start mysql-server

Install mysql-server and start it up. If you're on Yosemite (Mac OS X 10.10), download the DMG for 10.9. It should work fine.

Start the server

mysql.server start

Step 6 - Create Development MySQL Database

Run bundle exec rake db:create, bundle exec rake db:migrate, and then bundle exec rake db:seed to create a development MySQL database with some example Agents.

Troubleshooting

If after running bundle exec rake db:migrate, you receive an error like the one below:

Devise.secret_key was not set. Please add the following to your Devise initializer:

config.secret_key = '7e24f39f2e8dc9af2d339afe55955c711162fa0bed3ea9529f404cf03fe2212a090271c01bdfd06385b033515ef5619ba1744a471f94a126305cb96ce87b8ee0'

Please ensure you restarted your application after installing Devise or setting the key.

This mean you will need to rename the .env.example file to .env and modify to include your secret key on line 4. Once you do that, you'll want to restart the server by running:

mysql.server stop
mysql.server start

From here on, the Quick Start section of the README should be able to guide you from the instructions at "Run bundle exec foreman start..."

Clone this wiki locally