Starting and stopping

This chapter describes how to start and stop the Gun application.

Setting up

Specify Gun as a dependency to your application in your favorite build tool.

With this is done by adding gun to the DEPS variable in your Makefile.

Adding Gun as an dependency
source-highlight: could not find a language definition for make


Gun is an OTP application. It needs to be started before you can use it.

Starting Gun in an Erlang shell
1> application:ensure_all_started(gun).


You can stop Gun using the application:stop/1 function, however only Gun will be stopped. This is the reverse of application:start/1. The application_ensure_all_started/1 function has no equivalent for stopping all applications.

Stopping Gun

Gun 2.1 User Guide


Version select

Like my work? Donate!

Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and is fantastic:

Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.