# Install Discourse on macOS for development

**URL:** https://meta.discourse.org/t/install-discourse-on-macos-for-development/15772
**Category:** Developer Guides
**Tags:** dev-install, how-to
**Created:** [May 19, 2014, 4:59pm UTC](https://meta.discourse.org/t/install-discourse-on-macos-for-development/15772 "2014-05-19T16:59:50Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [May 19, 2014, 4:59pm UTC](https://meta.discourse.org/t/install-discourse-on-macos-for-development/15772/1 "2014-05-19T16:59:51Z")

</div>

> ⚠ This guide covers installation instructions for a macOS development environment, for production guides see: [Install Discourse in production with the official supported instructions](https://meta.discourse.org/t/how-to-install-discourse-in-production/142537)

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 🚀 !

## Install Discourse Dependencies

You will need the following packages on your system:

- [Git](http://git-scm.com/)
- [rbenv](https://github.com/sstephenson/rbenv) or [asdf](https://asdf-vm.com/guide/getting-started.html)
- [ruby-build](https://github.com/sstephenson/ruby-build)
- [Ruby](https://www.ruby-lang.org/) (latest stable)
- [Rails](http://rubyonrails.org/)
- [PostgreSQL](http://www.postgresql.org/)
- [SQLite](https://sqlite.org/)
- [Redis](http://redis.io/)
- [Node.js](https://nodejs.org/en)
- [pnpm](https://pnpm.io/)
- [libvips](https://github.com/libvips/libvips/wiki#building-and-installing)
- [MailHog](https://github.com/mailhog/MailHog)\*\*
- [ImageMagick](http://www.imagemagick.org/)\*\*

_\*\* optional_

> restart your terminal

Now that we have installed Discourse dependencies, let’s move on to install Discourse itself.

## Restart your Terminal

Exit your shell and restarting it ensures that the paths to the installed packages are correctly picked up by the Terminal.

## Clone Discourse

Clone the Discourse repository in `~/discourse` folder:

```sh
git clone https://github.com/discourse/discourse.git ~/discourse

```

_`~` indicates home folder, so Discourse source code will be available in your home folder._

## Bootstrap Discourse

Switch to your Discourse folder:

```sh
cd ~/discourse

```

Install the needed gems

```sh
bundle install

```

Install the JS dependencies

```sh
pnpm install

```

Next, run these commands to set up your local Discourse instance:

```sh
bundle exec rake db:create
bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:create db:migrate

```

Start rails + Ember servers, you have two options here.

**Option 1** : using two separate Terminal tabs/windows, run Rails and the frontend bundler separately via

```sh
bundle exec rails server

```

and

```sh
bin/dev --only ember

```

**Option 2** : using only one Terminal tab/window:

```sh
bin/dev # runs Pitchfork and the frontend bundler together

```

🎉 You should now be able to navigate to [http://localhost:3000](http://localhost:3000) to see your local Discourse installation. (Note that the first load can take up to a minute as the server is warmed up.)

You can also try running the specs:

```sh
bundle exec rake autospec

```

All (or almost all) the tests should pass.

## Create New Admin

To create a new admin, run the following command:

```sh
RAILS_ENV=development bundle exec rake admin:create

```

Follow the prompts to create an admin account.

## Configure Mail

Run MailHog:

```sh
mailhog

```

* * *

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](https://meta.discourse.org/t/beginners-guide-to-creating-discourse-plugins/30515).

* * *

This document is version controlled - suggest changes [on github](https://github.com/discourse/discourse/blob/main/docs/developer-guides/docs/02-development-environments/04-macos-setup.md).

---

_[View the full topic](https://meta.discourse.org/t/install-discourse-on-macos-for-development/15772)._
