This guide covers installation instructions in development environment, for a production guide see: How to install Discourse in production (Discourse official install / standard install)
So you want to set up Discourse on macOS to hack on and develop with?
We’ll assume that you don’t have Ruby/Rails/Postgres/Redis installed on your Mac. Let’s begin!
Run this script in terminal, to setup Rails development environment:
bash <(curl -s https://raw.githubusercontent.com/discourse/install-rails/master/mac)
This script will install following new packages on your system:
In case you have any of this package pre-installed and don’t want to run entire script, see the script and pick the packages you don’t have currently installed. The script is fine-tuned for Discourse, and includes all the packages required for Discourse installation.
Now that we have installed Discourse dependencies, let’s move on to install Discourse itself.
Clone the Discourse repository in
git clone https://github.com/discourse/discourse.git ~/discourse
~ indicates home folder, so Discourse source code will be available in your home folder.
Switch to your Discourse folder:
Install the needed gems
Now that you have successfully installed gems, run these commands:
bundle exec rake db:create bundle exec rake db:migrate RAILS_ENV=test bundle exec rake db:create db:migrate
Try running the specs:
bundle exec rake autospec
All the tests should pass.
Start rails server:
bundle exec rails server
You should now be able to connect with your Discourse app on http://localhost:3000 - try it out!
Starting with Discourse 2.5+ EmberCLI is required in development and these additional steps will be required:
In a separate terminal instance, navigate to your discourse folder (
cd ~/discourse) and run:
You should now be able to navigate to http://localhost:4200 to see your local Discourse installation.
To create a new admin, run the following command:
RAILS_ENV=development bundle exec rake admin:create
Follow the prompts to create an admin account.
Congratulations! You are now the admin of your own Discourse installation!
Happy hacking! And to get started with that, see Beginner’s Guide to Creating Discourse Plugins.