Add Mac development environment setup instructions. Closes #250

This commit is contained in:
Aral Balkan 2017-05-16 16:04:50 +02:00
parent 63cc7d8849
commit c84f141e22
No known key found for this signature in database
GPG Key ID: 4EBA5FC41999F140
1 changed files with 73 additions and 0 deletions

View File

@ -3,6 +3,8 @@ Development guide
**Don't use Docker to do development**. It's a quick way to get Mastodon running in production, it's **really really inconvenient for development**. Normally in Rails development environment you get hot reloading of backend code and on-the-fly compilation of assets like JS and CSS, but you lose those benefits by compiling a Docker image. If you want to contribute to Mastodon, it is worth it to simply set up a proper development environment.
## Linux
In fact, all you need is described in the [production guide](Production-guide.md), **with the following exceptions**. You **don't** need:
- Nginx
@ -45,6 +47,77 @@ You can check code quality with:
rubocop
## Mac
These are self-contained instructions for setting up a development environment on a macOS system. It is assumed that youve cloned your fork of Mastodon to a local working directory and that you are in Terminal and in that directory.
### Prerequisites
- Get [Homebrew](https://brew.sh) and use it to install the other dependencies:
```
brew install imagemagick ffmpeg yarn postgresql redis rbenv nodejs
```
- Get [Xcode](https://developer.apple.com/xcode/) Commandline tools
```
xcode-select install
```
- Configure Rbenv:
```
rbenv init
rbenv install 2.4.1
```
- Install/configure bundler to use your local rbenv:
```
gem update --system
gem install bundler
rbenv rehash
```
- Configure [PostgreSQL](https://www.postgresql.org):
```
initdb /usr/local/var/postgres -E utf8
createdb
export PGDATA=/usr/local/var/postgres
/usr/local/bin/postgres
/usr/local/bin/psql
```
In the prompt:
```
CREATE USER mastodon CREATEDB;
\q
```
### Installation
```
bundle install --with development
yarn install --pure-lockfile
gem install foreman --no-ri --no-rdoc
bundle exec rails db:setup
bin/rails assets:precompile
```
### Start the server
```
foreman start
```
Go to http://localhost:3000 to see your development instance.
Admin account is `admin@localhost:3000`. Password is `mastodonadmin`.
## Development tips
You can use a localhost->world tunneling service like [ngrok](https://ngrok.com) if you want to test federation, **however** that should not be your primary mode of operation. If you want to have a permanently federating server, set up a proper instance on a VPS with a domain name, and simply keep it up to date with your own fork of the project while doing development on localhost.