Beginners Guide to Install Discourse on macOS for Development


(Sam Saffron) #23


(Lisa Wess) #24

Hey all, I followed this guide and it worked beautifully. Thank you for writing it up!

I’m having some problems now getting Tagger installed. Are there any caveats or differences for installing plugins on this type of installation? I haven’t tried others than Tagger; though I likely will want to. :slight_smile:

(Tuan Anh Tran) #26

For me, I setup vagrant and install an ubuntu box and follow OP’s other tutorial on how to install discourse on ubuntu. Works flawless as well.

Great guide.

(Clément V) #27

Hi Folks,
First I have to say that I’m not very experienced…
So I’ve followed precisely every steps of this howto.
Unfortunetly I’m stuck at the “bootstrap” step.
When I try to install the needed gems with ‘bundle install’ I get a warning telling that I’m running an old version of bundler.
Gems seem to be fetched anyway but at the end I got an error when installing better_errors (2.0.0) :

Gem::InstallError: better_errors requires Ruby version >= 2.0.0.
An error occurred while installing better_errors (2.0.0), and Bundler cannot
Make sure that gem install better_errors -v '2.0.0' succeeds before bundling.

I don’t know how to solve this.
Do I have to upgrade Ruby to an higher version than the one installed in the first script ?

If you have an idea about that I would be happy to read it :slight_smile:


(Chad) #28

This looks awesome! My plan is to run discourse on SmartOS but I haven’t had the time to dig into all the dependencies and sort out a base OS template. This guide will make my life a lot easier! Thank you.

Assuming I get something similar working on SmartOS, I’ll share. Though my goal is production, not just development/staging. I prefer SmartOS with zones, ZFS, and dtrace to Linux. I also prefer to separate apps from database, etc, so database will get its own zone, etc… Isolation can be a good thing, when it comes to security. :smile:

(Sam Saffron) #29


(James Cook) #30

As you’re not that experienced, look into something called Rbenv. This is a simple Ruby version manager and allows you to select different versions of ruby for different projects, depending on what they need.

If you take a look inside the Discourse root directory, you’ll see a file called .ruby-version.sample. Take the .sample off the end. Rbenv will read this file and automatically switch to the correct version of ruby for you, assuming it is installed. Read up on rbenv and how to install rubies.

Gems are installed in to different versions of ruby. So the reason that gem can’t install is because you’re currently using an older version of ruby. As soon as you switch to the correct version you’ll be fine.

(James Cook) #31

This seems to suggest (correct me if I’m wrong) that you can only set one locale per postgres database. So assuming I don’t want a Chinese postgres database, how would I get the Chinese test to pass? Or shall I just comment this test out if I’m working on a purely English setup?

(Sam Saffron) #32

I am not really sure, @neil and @eviltrout have tried to get this working before not sure if they succeeded. The issue is this:

A bug in postgres app that needs to be fixed in postgres app.

You can just ignore the test failure for now.

(Clément V) #33

Thanks rbenv solved my problem.
Thanks for your help and your in depth explanation.

(Neil Lalonde) #34

As that SO answer said, I needed to do initdb --locale=C -E UTF-8 and recreate my databases. That fixed it.

(James Cook) #35

Would this not create problems further down the line as you’re setting your locale to Chinese?

(Sam Saffron) #36

It does not cause issues, locale is never set to chinese, its just the simple tokenizer is bust out of the box on mac

(Jason May) #37

rake db:test:prepare now says

WARNING: db:test:prepare is deprecated. The Rails test helper now maintains your test schema automatically, see the release notes for details.

Should this be removed from docs/ and from these install guides?

I think db:seed_fu is still needed.

(Jason May) #38

I just found script/osx_dev. That appears to do all the things that @techAPJ mentioned at the top. Perhaps that script should be added to the main topic?

(Spero Koulouras) #39

Some small issues when installing on a fresh OSX Yosemite:

  • brew location changed. Pull request submitted with updated location.
  • brew services failed on my machine. Added comment to github with fix since not sure if this was general or not
  • phantomjs stable wants OSX Mavericks.

I used: brew install --HEAD phantomjs for Yosemite. This failed with:

==> ./ --confirm --jobs 4 --qt-config -openssl-linked
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [sub-cocoa-make_first] Error 2
make[2]: *** [sub-platforms-make_first] Error 2
make[1]: *** [sub-plugins-make_first] Error 2
make: *** [sub-src-make_first] Error 2

(Michael Tsao) #40

hello, i have some question. I use rake db:migrate,but migrate show some error.Can you help me,please?

1.git clone GitHub - discourse/discourse: A platform for community discussion. Free, open, simple.
3.rake db:create db:migrate

part of error:

= 20120514144549 AddReplyCountToPosts: migrating =============================
– add_column(:posts, :reply_count, :integer, {:null=>false, :default=>0})
-> 0.2841s
– execute(“UPDATE posts\n SET reply_count = (SELECT count(*) FROM posts AS p2 WHERE p2.reply_to_post_number = posts.post_number)”)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: You can’t specify target table ‘posts’ for update in FROM clause: UPDATE posts

(Kane York) #41

Discourse cannot run on MySQL, it requires Postgres.

Are you trying to install for development (this topic) or production (a forum with users)?

(Michael Tsao) #42

Thank you so much. it’s working. : )

(oxmhpark) #43

Thank you for the good instructions. Can I get some additional advices?


At first, I’d tried to install discourse using docker but ./launcher bootstrap app command gave no results. Next, using vagrant was successful. Currently I’ve tried to direct install and found that my installation has an in-editor upload problem. When I choose a local image and click Upload button, an overlay popup apears: “Sorry, there was an error uploading that file. Please try again.”.

I checked:

  • error.log – nothing.
  • uploading user avatar and profile background – done.
  • creating backup file – done.

In fact, my autospec results was not clean.