Beginners Guide to Install Discourse on macOS for Development

The quint-rails works. Thank you very much, sir! However, I now get this error:

1 Like

I ran into that same issue, but if you follow the instructions under the Addition Setup Tasks Section it should fix your issue with libv8.

4 Likes

I am having a similar issue to @lisajill above. Running Discourse on Mac works fine, but plugins don’t seem to install correctly. I tried installing a few plugins (Topic List Preview, Links Category, Static pages), they all look like they are installed correctly, but some features don’t work.

My plugin installation procedure was the following:

  • stop server with Ctrl + C
  • git clone plugin in /plugins
  • run rm -rf tmp; bundle exec rails server

I’ve got an error by trying to start rails server.
Any ideas guys, how to solve that issue :slight_smile:

MacBook-Air-3:discourse macbookair$ bundle exec rails server


=> Booting Thin
=> Rails 4.2.6 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) 2 Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) subscribe failed, reconnecting in 1 second. Call stack ["/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:345:in `rescue in establish_connection'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:331:in `establish_connection'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:101:in `block in connect'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:293:in `with_reconnect'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:100:in `connect'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:276:in `with_socket_timeout'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:133:in `call_loop'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/subscribe.rb:43:in `subscription'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/subscribe.rb:12:in `subscribe'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:2760:in `_subscription'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:2138:in `block in subscribe'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `block in synchronize'", "/usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `synchronize'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:2137:in `subscribe'", "/usr/local/lib/ruby/gems/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus/backends/redis.rb:304:in `global_subscribe'", "/usr/local/lib/ruby/gems/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus.rb:504:in `global_subscribe_thread'", "/usr/local/lib/ruby/gems/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus.rb:456:in `block in new_subscriber_thread'"]
Failed to report error: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) 2 Invalid argument subscribe failed, reconnecting in 1 second. Call stack ["/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/connection/hiredis.rb:19:in `connect'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/connection/hiredis.rb:19:in `connect'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:336:in `establish_connection'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:101:in `block in connect'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:293:in `with_reconnect'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:100:in `connect'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:276:in `with_socket_timeout'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:133:in `call_loop'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/subscribe.rb:43:in `subscription'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/subscribe.rb:12:in `subscribe'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:2760:in `_subscription'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:2138:in `block in subscribe'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `block in synchronize'", "/usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `synchronize'", "/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:2137:in `subscribe'", "/usr/local/lib/ruby/gems/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus/backends/redis.rb:304:in `global_subscribe'", "/usr/local/lib/ruby/gems/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus.rb:504:in `global_subscribe_thread'", "/usr/local/lib/ruby/gems/2.3.0/gems/message_bus-2.0.0.beta.11/lib/message_bus.rb:456:in `block in new_subscriber_thread'"]
Exiting
/usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:345:in `rescue in establish_connection': Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) (Redis::CannotConnectError)
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:331:in `establish_connection'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:101:in `block in connect'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:293:in `with_reconnect'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:100:in `connect'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:364:in `ensure_connected'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:221:in `block in process'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:306:in `logging'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:220:in `process'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis/client.rb:120:in `call'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:862:in `block in get'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `block in synchronize'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:58:in `synchronize'
	from /usr/local/lib/ruby/gems/2.3.0/gems/redis-3.3.0/lib/redis.rb:861:in `get'
	from /Users/macbookair/Herokuproject/discourse/lib/discourse_redis.rb:184:in `block (3 levels) in <class:DiscourseRedis>'
	from /Users/macbookair/Herokuproject/discourse/lib/discourse_redis.rb:150:in `ignore_readonly'
	from /Users/macbookair/Herokuproject/discourse/lib/discourse_redis.rb:184:in `block (2 levels) in <class:DiscourseRedis>'
	from /Users/macbookair/Herokuproject/discourse/config/initializers/100-secret_token.rb:6:in `<top (required)>'
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `block in load'
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:652:in `block in load_config_initializer'
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:166:in `instrument'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:651:in `load_config_initializer'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:615:in `each'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:615:in `block in <class:Engine>'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `each'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `tsort_each_child'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:415:in `call'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
	from /usr/local/Cellar/ruby/2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `public_send'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `method_missing'
	from /Users/macbookair/Herokuproject/discourse/config/environment.rb:5:in `<top (required)>'
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
	from /Users/macbookair/Herokuproject/discourse/config.ru:2:in `block in <main>'
	from /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
	from /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
	from /Users/macbookair/Herokuproject/discourse/config.ru:in `new'
	from /Users/macbookair/Herokuproject/discourse/config.ru:in `<main>'
	from /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
	from /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
	from /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
	from /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
	from /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/server.rb:61:in `app'
	from /usr/local/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/server.rb:139:in `log_to_stdout'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/server.rb:78:in `start'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:80:in `block in server'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'

Hello,

Thanks for the guide thus far.

I’m currently getting this error while trying ‘bundle exec rake autospec’

optipng worker: `optipng` not found; please provide proper binary or disable this worker (--no-optipng argument or `:optipng => false` through options)
jhead worker: `jhead` not found; please provide proper binary or disable this worker (--no-jhead argument or `:jhead => false` through options)
jpegoptim worker: `jpegoptim` not found; please provide proper binary or disable this worker (--no-jpegoptim argument or `:jpegoptim => false` through options)
gifsicle worker: `gifsicle` not found; please provide proper binary or disable this worker (--no-gifsicle argument or `:gifsicle => false` through options)
gifsicle worker: `gifsicle` not found; please provide proper binary or disable this worker (--no-gifsicle argument or `:gifsicle => false` through options)
svgo worker: `svgo` not found; please provide proper binary or disable this worker (--no-svgo argument or `:svgo => false` through options)
optipng worker: `optipng` not found; please provide proper binary or disable this worker (--no-optipng argument or `:optipng => false` through options)
jhead worker: `jhead` not found; please provide proper binary or disable this worker (--no-jhead argument or `:jhead => false` through options)
jpegoptim worker: `jpegoptim` not found; please provide proper binary or disable this worker (--no-jpegoptim argument or `:jpegoptim => false` through options)
gifsicle worker: `gifsicle` not found; please provide proper binary or disable this worker (--no-gifsicle argument or `:gifsicle => false` through options)
gifsicle worker: `gifsicle` not found; please provide proper binary or disable this worker (--no-gifsicle argument or `:gifsicle => false` through options)
svgo worker: `svgo` not found; please provide proper binary or disable this worker (--no-svgo argument or `:svgo => false` through options)

Apart from that I have some asteriks

...........*...................................................................*........................................................................................................................................................................................................................................................................................................................................................................................................*.........................................................................................................................*.................................

Also, some failed test.

................................................................................................................................................................................................................................................................................................................................................................................................................................................F...................................................F..F..................................FF........................FF.......................................................................................................................................................................................................................................................................F....F.................................F................................................................F..................................................................................................................................................................................................

This is the third time I’ll be running the said command and I’m really new to ruby on rails.

In summary,

Finished in 12 minutes 26 seconds (files took 22.56 seconds to load)
5304 examples, 26 failures, 13 pending

Can someone suggest a solution please?

I will be launching the app shortly

Run following commands:

brew install advancecomp gifsicle jhead jpegoptim jpeg optipng pngcrush pngquant
RAILS_ENV=test rake db:drop db:create db:migrate
bundle exec rake autospec

Now tests should be passing and everything should be fine.

(Updated the Mac install script to reflect above changes)

4 Likes

Many Thanks @techAPJ

Here is the current status, from 26 failures to 1 failure.

Finished in 10 minutes 20 seconds (files took 27.65 seconds to load)
5304 examples, 1 failure, 13 pending

Failed examples:

rspec ./spec/components/discourse_updates_spec.rb:50 # DiscourseUpdates version check was done at the current installed version a good version check request happened recently and server is not up-to-date returns the timestamp of the last version check

How do I get rid of this last failure?

Finally @techAPJ, thank you.

Finished in 12 minutes 52 seconds (files took 59.66 seconds to load)
5304 examples, 0 failures, 13 pending

However, there is still this.

Randomized with seed 26201
F

Failures:

  1) DiscourseUpdates version check was done at the current installed version a good version check request happened recently and server is not up-to-date returns the timestamp of the last version check
     Failure/Error: expect(subject['updated_at']).to be_within_one_second_of(12.hours.ago)
       2016-07-03 10:04:05 UTC is not within 1 second of 2016-07-03 10:04:06 UTC
     # /Users/kehinde/.rvm/gems/ruby-2.3.0/gems/given_core-3.7.1/lib/given/rspec/monkey.rb:21:in `handle_matcher'
     # ./spec/components/discourse_updates_spec.rb:51:in `block (5 levels) in <top (required)>'

Finished in 1.45 seconds (files took 27.22 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/components/discourse_updates_spec.rb:50 # DiscourseUpdates version check was done at the current installed version a good version check request happened recently and server is not up-to-date returns the timestamp of the last version check

One other question. Can the discourse be customized to have this UI feel http://www.wired.com/ ? Any related discourse example so far?

Is it possible to reset a discourse completely?

Yes, do:

rake db:drop db:create db:migrate

Note that this will wipe everything and you will have to create your Admin user account again.

6 Likes

If the admin script somehow doesn’t work for you and you need to activate your user account…

For anyone struggling to get their user activated firstly you need to run Sidekiq

bundle exec sidekiq

Then you need to install and run mailcatcher. Execute the following in a terminal:

gem install mailcatcher

Once it’s installed, run it simply by typing mailcatcher in a terminal

mailcatcher

Then browse to http://127.0.0.1:1080/ in your browser to open Mailcatcher

Start the rails server

bundle exec rails s

Now try and log in to your Discourse. You should hopefully see a message pop up in the mailcatcher tab of your browser. Click the link and your user will be activated.

Or you can run rake admin:create and answer the questions :wink:

3 Likes

I did. It didn’t work.

It should. Can you try running it again with another email?

Yep it works. I literally have no clue how it didn’t work the first time, I did exactly the same thing.

When I logged in as the first user I created it popped the message up about my account not being activated and to resend the email.

6 posts were split to a new topic: Getting error when installing Nokogiri on Mac OS X for developemnt

6 posts were split to a new topic: Getting error when trying to perform migrations on Mac OS X for developemnt

A post was merged into an existing topic: Getting error when installing Nokogiri on Mac OS X for developemnt

Can anyone explain why this seeds the test db before we run autospec? Lots of things fail with count errors but as soon as I reset the test db things start passing.

I just wondered why the test DB is being seeded with apparently incorrect data? Is this something that needs fixing?

task 'test:prepare' => 'environment' do
  I18n.locale = SiteSetting.default_locale rescue :en
  SeedFu.seed
end

Hi there,

I’d like to install discourse on my Mac and already figured out how to deal with the Nonogiri issue.

But now there’s a new one with libv8. Always get that error:

Your bundle is locked to libv8 (5.3.332.38.1), but that version could not be found in any of the sources listed in your Gemfile. If you haven’t changed sources, that means the author of libv8 (5.3.332.38.1) has removed it. You’ll need to update your bundle to a different version of libv8 (5.3.332.38.1) that hasn’t been removed in order to install.
Run bundle install to install missing gems.

Can someone help? Thanks!