# Install the Discourse Theme CLI console app to help you build themes

**URL:** https://meta.discourse.org/t/install-the-discourse-theme-cli-console-app-to-help-you-build-themes/82950
**Category:** Developer Guides
**Tags:** how-to, theme-guides
**Created:** [3월 14, 2018, 5:24오전 UTC](https://meta.discourse.org/t/install-the-discourse-theme-cli-console-app-to-help-you-build-themes/82950 "2018-03-14T05:24:33Z")
**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: [3월 14, 2018, 5:24오전 UTC](https://meta.discourse.org/t/install-the-discourse-theme-cli-console-app-to-help-you-build-themes/82950/1 "2018-03-14T05:24:34Z")

</div>

The [![discourse](https://global.discourse-cdn.com/meta/original/4X/2/1/3/21366b58dab3ee1ef263a8e74c09dd323ee348de.png) Discourse Theme CLI](https://github.com/discourse/discourse_theme) is a ruby gem that allows you to use your editor of choice when developing Discourse themes and theme components. As you save files the CLI will update the remote theme or component and changes to it will appear live!

## Installing

To play with it, make sure you have **Ruby 2.5** or up installed.

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/d/0/5d0aaed7923ecdd7d6a652e39a0e27507ea08e1b.png)

If you are on Windows, you have 2 options:

**Option 1** : [Windows Subsystem for Linux](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux).

Windows 10 has access to a full Linux environment, you can use it to install ruby simply with `sudo apt-get install ruby`, this will give you Ruby 2.3.

**Options 2** : Older Windows

Older versions of Windows have no access to WSL, you can easily install Ruby with [Ruby Installer](https://rubyinstaller.org/), go for the recommended version and default settings for the install.

 ![image](https://global.discourse-cdn.com/meta/original/4X/e/6/c/e6c0533a52c6b2d73fa55f966008af9815b7b635.png)

Mac OS version 10.13.3 ship with Ruby 2.3 out of the box, nothing special is needed. If you are running an earlier version of Mac OS consider using [rvm](https://rvm.io/rvm/install), [rbenv](https://github.com/rbenv/rbenv) or [homebrew](https://brew.sh/) to install a recent ruby.

* * *

Once Ruby 2.2 or later is running, open a terminal or command shell and run:

```sh
gem install discourse_theme

```

Once installed, to learn more about it:

```sh
discourse_theme

```

## Upgrading

```sh
gem update discourse_theme

```

## Features

The CLI provides 3 main functions:

### discourse\_theme new

You can use it to quickly create a new theme with `discourse_theme new YOUR_DIR_NAME`

### discourse\_theme watch

You can use it to monitor a theme and **synchronize** with a discourse site (with live refresh) using `discourse_theme watch YOUR_DIR_NAME`

What this means is that you can use **your own editor** to edit you theme and site will magically :unicorn: update with the changes!

### discourse\_theme download

You can download an existing theme from Discourse using `discourse_theme download YOUR_DIR_NAME`. You will then be given the option to start “watching” straight away!

## Credentials

You will need to generate an API Key. Go to the admin area and generate a key there.

- ❗ Select a “User Level” of `Single User` when generating the key, not `All Users`.
- ❗ Make sure to check `Global Key` or you will receive 403 forbidden errors.

Credentials are (optionally) stored at `~/.discourse_theme`. API keys are stored per-site, and the URL/theme\_id for each directory is also tracked. If you ever need to change your settings, just add `--reset` to any command and you will be prompted for all values again.

## Testimonials

“This tool is truly a GEM!” @awole20  
“This is very very good.” @awesomerobot  
“It’s working 🙂 And it’s pretty dosh garn cool. Nice!” @angus  
“OMG. It’s unbelievable.” @pfaffman

* * *

This document is version controlled - suggest changes [on github](https://github.com/discourse/discourse/blob/main/docs/developer-guides/docs/05-themes-components/05-theme-cli.md).

---

_[View the full topic](https://meta.discourse.org/t/install-the-discourse-theme-cli-console-app-to-help-you-build-themes/82950)._
