This guide is for getting a local development clone of Ghost setup on your local machine. If you are only interested in running a Ghost site or developing Ghost themes please use the general install guide instead.
yarn, rather than
npm for managing our dependencies & running scripts. You will need it installed in order to work on Ghost.
no sudo for local development
if your environment requires
sudo when installing npm packages we highly recommend fixing that before continuing.
These commands only need to be run once, they're designed to get your Ghost install up and running quickly 🚀
Clone Ghost and make it your working directory:
git clone email@example.com:TryGhost/Ghost.git && cd Ghost
Install global npm packages
yarn global add knex-migrator grunt-cli ember-cli bower
Run the first-time setup & install tasks:
- install dependencies, initialise the database, set up git hooks & initialise submodules
- shortcut for
yarn install && knex-migrator init && grunt symlink && grunt init
- runs a first build of the admin, and can take a very long time
- should only ever be run once!
You're ready! Once you see a "done" message you can start Ghost:
- Visit your new site at http://localhost:2368/
- See the list of development commands below for other options
yarn setup - run it once!
There are a number of ways to start Ghost, each with their own benefits and trade-offs. All of these will, by default, serve Ghost from http://localhost:2368./
- the most general way of running Ghost in development mode
- builds admin client files on start
- watches server files and restarts on changes
- watches admin client files and performs a quick rebuild on changes including live-reload
grunt dev --server
- same as above but doesn't build the client files on start or watch the client files for changes
- ensure the client files are built and/or up to date first (see
- useful to minimise startup time and preserve system resources if you know you won't be modifying any client files
- builds admin client files for production
- does not (!) watch for changes to server files or admin client files
- start Ghost with
npm start --production
- simply starts the Ghost server with no client build, file watching or automatic restarts
- useful when you want a quick startup and don't care about needing to restart manually if you change anything
- does not build client files & may leave you with a blank admin panel (see
Ghost uses it's own tool called
knex-migrator for managing database migrations.
- if you want to reset your database you can run this command followed by
- initialises your database
- it populates the tables and inserts all fixtures
If you want to reset your production database you can use
NODE_ENV=production knex-migrator reset followed by
NODE_ENV=production knex-migrator init
- re-initialises the submodules, if you have problems with them
- checks out the master branch and pulls from upstream for Ghost, Ghost-Admin, and Casper to bring everything up to date
yarn installfor each submodule so that you can run
grunt devstraight away
- by default this will use
upstreamas the name of your upstream remote, if you use an alternative naming scheme for your remotes you can pass a flag
grunt master --upstream=origin
- builds the admin client files
- useful if you've just updated the client and don't want the overhead of building/watching client files by using
By default the tests run with SQlite. If you would like to run your tests with MySQL,
NODE_ENV=testing-mysql in front of the grunt command.
- run all server tests
- run all server unit tests
- run all server integration tests
- run all server route tests
- run a single test
- path can be absolute or relative
- terminal auto completion can be very useful
- alternatively: use
.onlyon your test to run a single test
- runs jshint and jshintrc across all of the server files
This error means that Ghost is already running, and you need to stop it.
This error means that the mentioned file doesn't exist.
yarn has not completed successfully.
Please remove your node_modules and re-run
This warning can happen if you switch node versions. You can resolve this warning by reinstalling your node_modules.