Beginners Guide to Install Discourse on macOS for Development

Here is the guide you are looking for:

I will update the first post to link to that guide for M1 macs.

4 Likes

Getting this error when running bundle exec rake autospec:

An error occurred while loading ./spec/components/feed_item_accessor_spec.rb. - Did you mean?
                    rspec ./spec/components/email/processor_spec.rb
                    rspec ./spec/components/cooked_post_processor_spec.rb

Failure/Error: require 'rss'

LoadError:
  cannot load such file -- rss

I did gem install rss, just in case and still reading this

This is related to using ruby 3.0.1. If you switch to ruby 2.7.3 it should work. I’m not sure what our current timeline is for switching to ruby 3, but there appears to be several issues like this that need to be resolved first.

6 Likes

After following the steps mentioned here macOS Catalina Discourse Development Environment Notes - Discourse System Administration - Unix Linux Community to run bundle install, I tried to use bundle exec rake db:migrate (as stated in the steps above), and it showed me this error:

rake aborted!
ArgumentError: wrong number of arguments (given 1, expected 0; required keywords: site_setting_name, title, raw)

Does anyone know what I could do?

NOTE: I’m using macOS version 11.4

NOTE: I followed the steps in the link in this post because I was having problems with cppjieba_rb. Is it correct to do it this way?

1 Like

I ran into the same error on macOS 11.4. It turned out to be the ruby version (I was running 3.0.0). This comment recommended 2.7.3.

$ echo '2.7.3' > .ruby-version
$ rbenv install 2.7.3
...
$ bundle install

After downgrading to ruby 2.7.3 bundle exec rake db:migrate succeeded.

5 Likes

Hi,

I’m setting up my environment, and I got to the point where I run bin/ember-cli in the discourse directory. However, I got this message:

 % bin/ember-cli

Traceback (most recent call last):
	1: from bin/ember-cli:47:in `<main>'
bin/ember-cli:47:in `exec': No such file or directory - yarn (Errno::ENOENT)

I’m I running the code in a wrong way? Does anyone have a suggestion? Should I install ember separately following these steps: Installing - Basic use - Ember CLI Guides?

Thank you, it worked!

1 Like

@jonathan_h Hm, It looks like it can’t find yarn. The setup script has a line that installs it, but you could try running it separately:

brew install yarn
1 Like

I just got these failures when running bundle exec rake autospec:

Failures:
  1) Wizard::Builder colors step when the default theme has been overridden by a theme without a color scheme should set the right default values
     Failure/Error: expect(field.required).to eq(false)
       expected: false
            got: true
       (compared using ==)
       Diff:
       @@ -1 +1 @@
       -false
       +true
     # ./spec/components/wizard/wizard_builder_spec.rb:194:in `block (4 levels) in <main>'
     # ./spec/rails_helper.rb:279:in `block (2 levels) in <top (required)>'
  2) Wizard::Builder colors step when the default theme has been overridden by a theme with a color scheme should set the right default values
     Failure/Error: expect(field.required).to eq(false)
       expected: false
            got: true
       (compared using ==)
       Diff:
       @@ -1 +1 @@
       -false
       +true
     # ./spec/components/wizard/wizard_builder_spec.rb:206:in `block (4 levels) in <main>'
     # ./spec/rails_helper.rb:279:in `block (2 levels) in <top (required)>'
  3) Wizard::Builder colors step when the default theme has been override and the color scheme doesn't have a base scheme fallbacks to the color scheme name
     Failure/Error: expect(field.required).to eq(false)
       expected: false
            got: true
       (compared using ==)
       Diff:
       @@ -1 +1 @@
       -false
       +true
     # ./spec/components/wizard/wizard_builder_spec.rb:183:in `block (4 levels) in <main>'
     # ./spec/rails_helper.rb:279:in `block (2 levels) in <top (required)>'
  4) Wizard::Builder colors step when the default theme has not been override should set the right default values
     Failure/Error: SiteSetting.find_by(name: "default_theme_id").destroy!
     NoMethodError:
       undefined method `destroy!' for nil:NilClass
     # ./spec/components/wizard/wizard_builder_spec.rb:165:in `block (4 levels) in <main>'
     # ./spec/rails_helper.rb:279:in `block (2 levels) in <top (required)>'
  5) ApplicationController#handle_theme selects the theme the user has selected
     Failure/Error: expect(controller.theme_id).to eq(SiteSetting.default_theme_id)
       expected: -1
            got: nil
       (compared using ==)
     # ./spec/requests/application_controller_spec.rb:451:in `block (3 levels) in <main>'
     # ./spec/rails_helper.rb:279:in `block (2 levels) in <top (required)>'
  6) ApplicationController#handle_theme does not allow non privileged user to preview themes
     Failure/Error: expect(controller.theme_id).to eq(SiteSetting.default_theme_id)
       expected: -1
            got: nil
       (compared using ==)
     # ./spec/requests/application_controller_spec.rb:489:in `block (3 levels) in <main>'
     # ./spec/rails_helper.rb:279:in `block (2 levels) in <top (required)>'
Finished in 49 minutes 32 seconds (files took 17.63 seconds to load)
15162 examples, 6 failures, 10 pending
Failed examples:
rspec ./spec/components/wizard/wizard_builder_spec.rb:193 # Wizard::Builder colors step when the default theme has been overridden by a theme without a color scheme should set the right default values
rspec ./spec/components/wizard/wizard_builder_spec.rb:205 # Wizard::Builder colors step when the default theme has been overridden by a theme with a color scheme should set the right default values
rspec ./spec/components/wizard/wizard_builder_spec.rb:182 # Wizard::Builder colors step when the default theme has been override and the color scheme doesn't have a base scheme fallbacks to the color scheme name
rspec ./spec/components/wizard/wizard_builder_spec.rb:168 # Wizard::Builder colors step when the default theme has not been override should set the right default values
rspec ./spec/requests/application_controller_spec.rb:440 # ApplicationController#handle_theme selects the theme the user has selected
rspec ./spec/requests/application_controller_spec.rb:486 # ApplicationController#handle_theme does not allow non privileged user to preview themes
Randomized with seed 65042

What should I do if I get some failed tests when running the autospec? How do failed tests affect the functionality of Discourse?

Thank you for the post. Before I begin, what are the MacOS minimum system requirements? Also, are there recommended RAM and storage requirements that should also be considered?
—Thanks, Alex

Is there an updated way to determine what version of discourse we are running locally?

Previously, you could look at the meta tags in page source, but that doesn’t seem to be available any more (I no longer see a meta tag that provides a discourse version).

Locally you should see it on the /admin page

Screen Shot 2021-07-27 at 2.00.12 PM

1 Like

Perfect. Thanks, @awesomerobot.