Beginners Guide to Install Discourse on Mac OS X (macOS) for Development

(Arpit Jalan) #86

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

(Arpit Jalan) #93

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

(James Cook) #94

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


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!

(Sam Saffron) #96

I am seeing libv8 here: All versions of libv8 | | your community gem host , did you try running bundle install ? Are you using Ruby 2.3?

(giorgia) #97

Hi everybody, thanks for the awesome guide.
I follow it step by step but when i got to: bundle exec rake db:migrate db:test:prepare db:seed_fu I got errors:

rake aborted!
SyntaxError: /Users/anaketa/Desktop/repos/discourse/lib/tasks/uploads.rake:598: syntax error, unexpected '\n', expecting :: or '[' or '.'
/Users/anaketa/Desktop/repos/discourse/lib/tasks/uploads.rake:600: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
  Number of `Upload` records in DB: #{uploads_count}
/Users/anaketa/Desktop/repos/discourse/lib/tasks/uploads.rake:600: syntax error, unexpected tIDENTIFIER, expecting keyword_end
  Number of `Upload` records in DB: #{uploads_count}
/Users/anaketa/Desktop/repos/discourse/lib/tasks/uploads.rake:601: syntax error, unexpected tIDENTIFIER, expecting keyword_end
  Number of `OptimizedImage` records in DB: #{optimized_images_count}
/Users/anaketa/Desktop/repos/discourse/lib/tasks/uploads.rake:604: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
  Number of images in uploads folder: #{paths_count}
/Users/anaketa/Desktop/repos/discourse/lib/tasks/uploads.rake:609: syntax error, unexpected keyword_do_block, expecting keyword_end
/Users/anaketa/Desktop/repos/discourse/lib/tasks/uploads.rake:618: syntax error, unexpected keyword_do_block, expecting end-of-input
...value['size'] }.reverse.each do |extname, value|
...                               ^
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/activesupport- `load'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/activesupport- `block in load'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/activesupport- `load_dependency'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/activesupport- `load'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/railties- `block in run_tasks_blocks'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/railties- `each'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/railties- `run_tasks_blocks'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/railties- `run_tasks_blocks'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/railties- `load_tasks'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/railties- `public_send'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/railties- `method_missing'
/Users/anaketa/Desktop/repos/discourse/Rakefile:7:in `<top (required)>'
/Users/anaketa/.rvm/gems/ruby-2.2.1/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/Users/anaketa/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
/Users/anaketa/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

i’m installed dependencies by my self since i already had some so it might be i forget something but:

  • Postgres is running with Postgres mac app
  • redis is running
  • rbenv local give me 2.3.0
  • i solve nogiri issue
  • I have ImageMagic and PhatomJS installed

Any suggestion where to look for fix this error?

(Arpit Jalan) #98

This error is because of old Ruby version, in your case looking at logs you are on ruby 2.2.1.

Even though you have installed rbenv I think your setup is still using rvm. I recommend nuking rvm (if you installed it exclusively for Discourse) and setting up rbenv. You may find this script helpful for setting up rbenv: install-rails/mac at master · techAPJ/install-rails · GitHub

(giorgia) #99

thanks @techAPJ. I had same impression so now i’m installing 2.3.0 with rvm as well.
I rvm use for other projects but i can totally switch, i also would prefer to keep just one.
But is not possible to run discourse with rvm instead or rbenv?

(Arpit Jalan) #100

You can definitely run Discourse with rvm as well, it’s just a matter of choice and I may be biased. :slight_smile:

If you are already using rvm for your other projects then you should use rvm for Discourse as well for simplicity.

(MorphZan) #101

Hi Guys

After step 1: bash <(curl -s

I received the following:

BUILD FAILED (OS X 10.12.3 using ruby-build 20170201)

Any Clues?

(Neil Lalonde) #102

Can you get more output from the log file it mentioned? /var/folders/22/... It’s only showing the last 10 lines which isn’t enough to show the error.

(MorphZan) #103

Ive basically killed the install and the log file is gone
I have setup a dedicated Mac Mini for this and I will restart the process a bit later today

Thanks for the time and trying to help - much appreciated.

Im sure ill have questions later!!! :smile:[quote=“neil, post:102, topic:15772, full:true”]
Can you get more output from the log file it mentioned? /var/folders/22/... It’s only showing the last 10 lines which isn’t enough to show the error.

(MorphZan) #104

I did a fresh install of Sierra 10.12.3
I followed the steps again and still not managing to come right, can I PM you a log file?
Any help would be greatly appreciated as Id really like to this up and running !!

(Arpit Jalan) #105

Sure, PM me the log file. I’ll look into it.

(Simeon Griggs) #106

Should/Could we be doing this with Docker for OSX now?

(Arpit Jalan) #107

I tried Docker app for Mac (a month ago) in combination with our Docker Dev image but it was painfully slow to develop/test on, so I do not recommend that.

Docker on Linux on the other hand is very fast and I use our Docker Dev image on my Ubuntu PC.

(Net Deamon) #108

Thanks !! It helped me to install discourse in mac

(Haoji Wu) #109

This guide is very helpful.
Although it didn’t pass every test in spec, I can launch my development Discourse in localhost:3000.
I also install Mailcatcher and Sidekiq to make everything work in my Mac


To send/receive user registration email I need to install Mailcatcher.
Mailcatcher is not a real smtp server and it will not send email to anywhere.
Mailcatcher acts as mock smtp server that Discourse sends emails to it.
I can check those emails in Mailcatcher UI in http://localhost:1080/

Install and run Mailcatcher:

gem install mailcatcher

By default Mailcatcher runs in localhost:1025, which is default address/port configured in Discourse config/environments/development.rb

config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }


In Discourse some features are run in async worker job, such as notification of mention.
I need to setup Sidekiq to make these features work:

gem install sidekiq
#go to discourse folder
cd ~/discourse  
RAILS_ENV=development bundle exec sidekiq -q critical -q low -q default -d -l log/sidekiq.log

Once Discourse is running I can check queue status in Sidekiq UI http://localhost:3000/sidekiq/queues
In normal case, if Sidekiq is running correctly Enqueued number should be 0 and Processed number should increase with more notifications and other jobs from Discourse.
If Sidekiq isn’t running correctly, there will be warning in Discourse admin Dashboard (http://localhost:3000/admin)

(Mittineague) #110

Hi howu welcome to the forum

My set up is different, but can you open up another CLI (or a better way) to run those in addition to starting up the server?

(Haoji Wu) #111

Mailcatcher and Sidekiq are running in background mode. I don’t need to open another terminal.