Beginners Guide to Install Discourse on macOS for Development

Yes, absolutely!

1 Like

Hmm. Seems to be stuck here when I run it:


I did cd ~/discourse, then typed bin/unicorn and got this. Did I do it wrong?

Screenshot to me looks like it is working as designed, look at localhost:9292/sidekiq to confirm

1 Like

Sidekiq is running? But not working. Also says idle.


Can someone also tell me why the images aren’t loading in development?
54%20AM

Check the URL of the image’s source. If it’s localhost and not localhost:3000, you’ll need to set the port Site Setting to 3000. You can do that from the rails console with:

SiteSetting.port = 3000

You’ll probably need to rebuild the post’s HTML to get the image to show up after setting the port.

2 Likes

Typing that returns this: SiteSetting.port: command not found.

Simon means from the rails console - bundle exec rails console first to get one. (ctrl-d to exit)

3 Likes

Just that, instead of 3000, I used 9292. :smile: Thanks! I’m still unsure why there is this message even though I’m running bin/unicorn .

So tried this dumpster fire again 5 months later, ran into 4 failures so I googled how to fix them…and then I found this thread with my original post with no answer, so I’m posting again!

macOS Mojave 10.4.4

Failures:

  1) FileStore::LocalStore#remove_upload moves the file to the tombstone
     Failure/Error: expect(File.mtime(tombstone_path)).to_not eq(mtime)
     
       expected: value != 2019-04-04 10:31:43.000000000 -0500
            got: 2019-04-04 10:31:43.000000000 -0500
     
       (compared using ==)
     
       Diff:
       
     # ./spec/components/file_store/local_store_spec.rb:53:in `block (3 levels) in <main>'

  2) Search ignore_diacritics allows strips correctly
     Failure/Error: expect(results.posts.length).to eq(1)
     
       expected: 1
            got: 0
     
       (compared using ==)
     # ./spec/components/search_spec.rb:1280:in `block (3 levels) in <main>'

  3) Search include_diacritics allows strips correctly
     Failure/Error: expect(results.posts.length).to eq(1)
     
       expected: 1
            got: 0
     
       (compared using ==)
     # ./spec/components/search_spec.rb:1301:in `block (3 levels) in <main>'

  4) SearchLog.term_details should only use the date for the period
     Failure/Error: expect(details[:data].first[:y]).to eq(2)
     
       expected: 2
            got: 1
     
       (compared using ==)
     # ./spec/models/search_log_spec.rb:174:in `block (3 levels) in <main>'

Finished in 8 minutes 12 seconds (files took 8.2 seconds to load)
10969 examples, 4 failures, 3 pending

Failed examples:

rspec ./spec/components/file_store/local_store_spec.rb:38 # FileStore::LocalStore#remove_upload moves the file to the tombstone
rspec ./spec/components/search_spec.rb:1266 # Search ignore_diacritics allows strips correctly
rspec ./spec/components/search_spec.rb:1288 # Search include_diacritics allows strips correctly
rspec ./spec/models/search_log_spec.rb:165 # SearchLog.term_details should only use the date for the period

I’ve run the setup about 4 times, have not deviated a single bit and still run into these issues. Am I to assume that this software is just broken and to move on?

Running the rspec tests is failing, but that doesn’t mean your development install is hosed.

Have you tried running bundle exec rails s and going to http://localhost:3000 to see if it works?

2 Likes

No, I had not tried continuing past a step that tells me all tests should pass when they fail.

Running the command you provided does give me access to that URL and I can start working on the Discourse, but with the failed tests will I have issues moving my setup to live?

I’d assume if the tests do not all need to pass, that it would not be stated they all need to pass.

That is some Mac issue with Postgres specific to translations.

Homebrew installs a broken Postgres, to fix use:

initdb --locale=C -E UTF-8 /usr/local/var/postgres1
brew services postgres stop
mv /usr/local/var/postgres /usr/local/var/postgres2
mv /usr/local/var/postgres1 /usr/local/var/postgres
brew services postgres start

createdb discourse_development

# select to_tsvector('english', 'abcd สวัสดี');
    to_tsvector
-------------------
 'abcd':1 'สวัสดี':2
(1 row)

I made this PR to hopefully resolve this going forward:

13 Likes

Hey, I’m trying to install on Mojave, and after running source ~/.bashrc I receive the error messages:

-bash: /usr/local/Cellar/rbenv/1.1.2/libexec/../completions/rbenv.bash: line 8: syntax error near unexpected token ('

and

-bash: /usr/local/Cellar/rbenv/1.1.2/libexec/../completions/rbenv.bash: line 8: local words=("${COMP_WORDS[@]}")'

Any ideas this is referring to?

Hello, I continued the process, updated bundle using gem install bundler like recommended above and also ran:

bundle exec rake autospec which showed 333 errors:

Finished in 19 minutes 50 seconds (files took 17.48 seconds to load)
11038 examples, 333 failures, 4 pending

See screenshots attached. Any idea how to resolve this?

Did you try running db:migrate as follows ?

RAILS_ENV=test LOAD_PLUGINS=1 rake db:migrate

3 Likes

Regarding urandom issues

Try

5 Likes

Thanks @venarius and @sam. It improved a bit, now with:

Finished in 16 minutes 22 seconds (files took 15.88 seconds to load) 11038 examples, 199 failures, 4 pending

Most errors are failed to get urandom, except the first which is:

LoadError: cannot load such file -- /Users/sunyata/discourse/app/models/topic_notifier

Most failed examples are rspec. Is the first load error the cause of all these problems? Also, in the progress area, it says:

svgo worker: `svgo` not found; please provide proper binary or disable this worker (--no-svgo argument or `:svgo => false` through options)
..svgo worker: `svgo` not found; please provide proper binary or disable this worker (--no-svgo argument or `:svgo => false` through options)
.....head: illegal line count -- -500

How do you disable workers or provide the proper binary?

Thanks

For svgo you need to install node and then npm install -g svgo

4 Likes