Permalink
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (58 sloc) 3.5 KB
---
title: Installing Lucky
order: 1
intro: >
Learn how to install Crystal, Lucky, and the required dependencies. Lucky
works on macOS and Linux machines. A few dependencies are required before
getting started.
---
## Install Required Dependencies
To get Lucky, you need to install these first.
* Install one of these process managers: [Overmind (recommended)](https://github.com/DarthSim/overmind#installation),
[Heroku CLI (great if you plan to use Heroku to deploy)](https://devcenter.heroku.com/articles/heroku-cli#download-and-install),
[forego](https://github.com/ddollar/forego#installation),
or [foreman](https://github.com/ddollar/foreman#installation).
* [Node](https://nodejs.org/en/download/). Requires at least v6
* [Yarn](https://yarnpkg.com/lang/en/docs/install/)
* [Crystal v0.27](https://crystal-lang.org/docs/installation/)
* Postgres ([macOS](https://postgresapp.com)/[Others](https://wiki.postgresql.org/wiki/Detailed_installation_guides))
* Necessary libraries: On Debian (Ubuntu should be similar) run "apt-get install libc6-dev libevent-dev libpcre2-dev libpng-dev libssl1.0-dev libyaml-dev zlib1g-dev"
* Necessary libraries on Fedora (28): run "dnf install glibc-devel libevent-devel pcre2-devel openssl-devel libyaml-devel zlib-devel libpng-devel". libpng-devel is for Laravel Mix
## Install Lucky
Once the required dependencies are installed, set up Lucky for your system.
### On macOS
* Install [Homebrew](https://brew.sh/)
* Run `brew install openssl` to make sure you have OpenSSL
* Run `brew tap luckyframework/homebrew-lucky`
* Run `brew install lucky`
* Make sure [Postgres CLI tools](https://postgresapp.com/documentation/cli-tools.html)
are installed if you're using Postgres.app
* If you are on macOS High Sierra you need to add `export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig`
to your `~/.bash_profile` or `~/.zshrc`
> If you get an error like this: `Package libssl/libcrypto was not found in the
pkg-config search path` then be sure to run the last step listed above so that
Crystal knows where OpenSSL is located.
### On Linux
* `git clone` the CLI repo at https://github.com/luckyframework/lucky_cli
* cd into the newly cloned directory
* Check out latest [released version](https://github.com/luckyframework/lucky_cli/releases) `git checkout v0.12.0`
* Run `shards install`
* Run `crystal build src/lucky.cr --release --no-debug`
* Move the generated `lucky` binary to your path. Most of the time you can move
it to `/usr/local/bin` and it should work.
If you needed different steps, please help contribute to this section by
[editing this page on GitHub](https://github.com/luckyframework/website/blob/master/source/guides/installing.html.md.erb).
## Start a New Project
To start a new project, run `lucky init`.
This will start the new project wizard. You can set up the project name, choose API only,
and whether you want Lucky to generate authentication for you.
## Running a Lucky Project
To start the server and run your project, first change into the directory for your
newly created app with `cd {project_name}`. Then run `bin/setup` to install dependencies
and `lucky dev` to start the server.
Running `lucky dev` will use an installed process manager (Overmind, Foreman,
etc.) to start the processes defined in `Procfile.dev`. By default
`Procfile.dev` will start the lucky server, and will start asset compilation.
> Lucky will look for a number of process managers. So if you prefer Forego
and someone else on your team prefers to use Overmind, `lucky dev` will work
for both of you.