Mattermost Logo
Edit on GitHub

Developer Setup

Set up your development environment for building, running, and testing the Mattermost server.

  1. Install and configure Docker CE: https://docs.docker.com/docker-for-mac/.

  2. Add dockerhost as an alias for 127.0.0.1 for use by various Mattermost build scripts:

    • Edit /etc/hosts file as an administrator (e.g. sudo) and add the following line:

      127.0.0.1    dockerhost
  3. Download and install homebrew: https://brew.sh/.

  4. Install Go:

    brew install go
  5. Update your shell’s initialization script (e.g. .bashrc or .zshrc) and add the following:

    export GOPATH=$HOME/go
    export PATH=$PATH:$GOPATH/bin
    ulimit -n 8096
  6. Re-source your shell’s initialization script to update GOPATH and PATH in your current shell:

    source $HOME/.bashrc
  7. Fork https://github.com/mattermost/mattermost-server

  8. Clone the Mattermost source code from your fork:

    export GITHUB_USERNAME=my_username
    mkdir -p $(go env GOPATH)/src/github.com/mattermost
    git clone https://github.com/$GITHUB_USERNAME/mattermost-server.git $(go env GOPATH)/src/github.com/mattermost/mattermost-server
  9. Start the server and test your environment:

    cd $(go env GOPATH)/src/github.com/mattermost/mattermost-server
    make run-server
    curl http://localhost:8065/api/v4/system/ping
    make stop-server

    If successful, the curl step will return a JSON object:

    {"AndroidLatestVersion":"","AndroidMinVersion":"","DesktopLatestVersion":"","DesktopMinVersion":"","IosLatestVersion":"","IosMinVersion":"","status":"OK"}

    Note: Browsing directly to http://localhost:8065/ will display a 404 Not Found until the web app is configured. See Web App Developer Setup and Mobile App Developer Setup for additional setup.

  1. Install and configure Docker CE:

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo usermod -aG docker $(whoami)
    docker login

    If you prefer to perform these steps manually:

  2. Add dockerhost as an alias for 127.0.0.1 for use by various Mattermost build scripts:

    • Edit /etc/hosts file as an administrator (e.g. sudo) and add the following line:

      127.0.0.1    dockerhost
  3. Install Go:

    sudo apt-get install -y build-essential
    wget https://storage.googleapis.com/golang/go1.11.linux-amd64.tar.gz
    sudo tar -C /usr/local -xzf go1.11.linux-amd64.tar.gz
  4. Update your shell’s initialization script (e.g. .bashrc or .zshrc) and add the following:

    export GOPATH=$HOME/go
    export PATH=$PATH:$GOPATH/bin
    export PATH=$PATH:/usr/local/go/bin
  5. Edit /etc/security/limits.conf as an administrator (e.g. sudo) and add the following lines, replacing {username} with your username:

    {username}  soft  nofile  8096
    {username}  hard  nofile  8096
  6. Logout and login to effect the changes above.

  7. Fork https://github.com/mattermost/mattermost-server

  8. Clone the Mattermost source code from your fork:

    export GITHUB_USERNAME=my_username
    mkdir -p $(go env GOPATH)/src/github.com/mattermost
    git clone https://github.com/$GITHUB_USERNAME/mattermost-server.git $(go env GOPATH)/src/github.com/mattermost/mattermost-server
  9. Start the server and test your environment:

    cd $(go env GOPATH)/src/github.com/mattermost/mattermost-server
    make run-server
    curl http://localhost:8065/api/v4/system/ping
    make stop-server

    If successful, the curl step will return a JSON object:

    {"AndroidLatestVersion":"","AndroidMinVersion":"","DesktopLatestVersion":"","DesktopMinVersion":"","IosLatestVersion":"","IosMinVersion":"","status":"OK"}

    Note: Browsing directly to http://localhost:8065/ will display a 404 Not Found until the web app is configured. See Web App Developer Setup and Mobile App Developer Setup for additional setup.

  1. Install and setup Docker.

  2. Add dockerhost as an alias for 127.0.0.1 for use by various Mattermost build scripts:

    • If using Docker for Windows, edit C:\Windows\System32\drivers\etc\hosts file as an administrator and add the following line:

      127.0.0.1     dockerhost
    • If using Docker Toolbox, use the Docker Quickstart Terminal to run:

      docker-machine ip default

      Then edit C:\Windows\System32\drivers\etc\hosts file as an administrator and add the following line, replacing {Docker-IP} with the IP address above:

      {Docker-IP} dockerhost
  3. Download and install Go from https://golang.org/dl/

  4. Fork https://github.com/mattermost/mattermost-server

  5. Clone the Mattermost source code from your fork:

    cd ~/go
    mkdir -p src/github.com/mattermost
    cd src/github.com/mattermost
    git clone https://github.com/{yourgithubusername}/mattermost-server.git
    cd mattermost-server
    git config core.eol lf
    git config core.autocrlf input
    git reset --hard HEAD
  6. Install and setup babun from http://babun.github.io/

  7. Setup the following environment variables (change the paths accordingly):

    export PATH="/c/Program Files/go/bin":$PATH
    export PATH="/c/Program Files/nodejs":$PATH
    export PATH="/c/Program Files/Git/bin":$PATH
    export GOROOT="c:\\Program Files\\go"
    export GOPATH="c:\\User\\{user-name}\\go"
    export PATH="/c/Program Files/Docker Toolbox":$PATH # change the path accordingly if you are using Docker for Windows
    eval $(docker-machine env default) # skip this line if you are using Docker for Windows
  8. Start the server and test your environment:

    cd $(go env GOPATH)/mattermost/mattermost-server
    make run-server
    curl http://localhost:8065/api/v4/system/ping
    make stop-server

    If successful, the curl step will return a JSON object containing "status":"OK".

    Note: Browsing directly to http://localhost:8065/ will display a 404 Not Found until the web app is configured. See Web App Developer Setup and Mobile App Developer Setup for additional setup.

This is an unofficial guide. Community testing, feedback and improvements are welcome and greatly appreciated.

  1. Install the Windows Subsystem for Linux: https://docs.microsoft.com/en-us/windows/wsl/install-win10

  2. Install and setup Docker:

  3. Add dockerhost as an alias for 127.0.0.1 for use by various Mattermost build scripts:

    • Edit C:\Windows\System32\drivers\etc\hosts file as an administrator and add the following line:

      127.0.0.1     dockerhost
  4. Install Go (using bash):

    sudo apt-get install -y build-essential
    wget https://storage.googleapis.com/golang/go1.11.linux-amd64.tar.gz
    sudo tar -C /usr/local -xzf go1.11.linux-amd64.tar.gz
  5. Set up your Go workspace:

    1. In PowerShell mkdir d:\Projects\go
    2. In bash ln -s "/mnt/d/Projects/go" /home/<Linux User>/go
  6. Update your shell’s initialization script (e.g. .bashrc or .zshrc) and add the following:

    export GOPATH=$HOME/go
    export PATH=$PATH:$GOPATH/bin
    export PATH=$PATH:/usr/local/go/bin
    ulimit -n 8096
  7. Reload your bash configuration to effect the changes above:

    source ~/.bashrc
  8. Fork Mattermost server on GitHub from https://github.com/mattermost/mattermost-server.

  9. Clone the Mattermost source code from your fork:

    export GITHUB_USERNAME=my_username
    mkdir -p $(go env GOPATH)/src/github.com/mattermost
    git clone https://github.com/$GITHUB_USERNAME/mattermost-server.git $(go env GOPATH)/src/github.com/mattermost/mattermost-server
  10. Start the server and test your environment:

    cd $(go env GOPATH)/mattermost/mattermost-server
    make run-server
    curl http://localhost:8065/api/v4/system/ping
    make stop-server

    If successful, the curl step will return a JSON object containing "status":"OK".

    Note: Browsing directly to http://localhost:8065/ will display a 404 Not Found until the web app is configured. See Web App Developer Setup and Mobile App Developer Setup for additional setup.

Troubleshooting: 

  1. If you see an error like the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'. Reinstall git for windows and make sure you choose Use Windows' default console window instead of Use MinTTY
  2. The LDAP docker container is sometimes slow to start. If you see the following message, either increase the wait time in the make file or run make run twice in a row.

    Ldap test user test.one
    starting mattermost-openldap
    ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
    ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
    ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
    ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
    ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
    ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
    Makefile:102: recipe for target 'start-docker' failed
    
  1. Install and configure Docker CE:

     sudo pacman -S docker
     sudo gpasswd -a $USER docker
     sudo systemctl enable docker.service
     sudo systemctl start docker.service
     newgrp docker
  2. Add dockerhost as an alias for 127.0.0.1 for use by various Mattermost build scripts:

    • Edit /etc/hosts file as an administrator (e.g. sudo) and add the following line:

      127.0.0.1    dockerhost
  3. Install Go:

    sudo pacman -S base-devel
    sudo pacman -S go
  4. Update your shell’s initialization script (e.g. .bashrc or .zshrc) and add the following:

    export GOPATH=$HOME/go
    export PATH=$PATH:$GOPATH/bin
    export PATH=$PATH:/usr/local/go/bin
  5. Edit /etc/security/limits.conf as an administrator (e.g. sudo) and add the following lines, replacing {username} with your username:

    {username}  soft  nofile  8096
    {username}  hard  nofile  8096
  6. Logout and login to effect the changes above.

  7. Fork https://github.com/mattermost/mattermost-server

  8. Clone the Mattermost source code from your fork:

    export GITHUB_USERNAME=my_username
    mkdir -p $(go env GOPATH)/src/github.com/mattermost
    git clone https://github.com/$GITHUB_USERNAME/mattermost-server.git $(go env GOPATH)/src/github.com/mattermost/mattermost-server
  9. Start the server and test your environment:

    cd $(go env GOPATH)/src/github.com/mattermost/mattermost-server
    make run-server
    curl http://localhost:8065/api/v4/system/ping
    make stop-server

    If successful, the curl step will return a JSON object:

    {"AndroidLatestVersion":"","AndroidMinVersion":"","DesktopLatestVersion":"","DesktopMinVersion":"","IosLatestVersion":"","IosMinVersion":"","status":"OK"}

    Note: Browsing directly to http://localhost:8065/ will display a 404 Not Found until the web app is configured. See Web App Developer Setup and Mobile App Developer Setup for additional setup.

  1. Install and configure Docker CE:

    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo usermod -aG docker $(whoami)
    docker login

    If you prefer to perform these steps manually:

  2. Add dockerhost as an alias for 127.0.0.1 for use by various Mattermost build scripts:

    • Edit /etc/hosts file as an administrator (e.g. sudo) and add the following line:

      127.0.0.1    dockerhost
  3. Install Go:

    sudo yum group install "Development Tools"
    sudo yum install -y wget libpng12
    wget https://storage.googleapis.com/golang/go1.11.linux-amd64.tar.gz
    sudo tar -C /usr/local -xzf go1.11.linux-amd64.tar.gz
  4. Update your shell’s initialization script (e.g. .bashrc or .zshrc) and add the following:

    export GOPATH=$HOME/go
    export PATH=$PATH:$GOPATH/bin
    export PATH=$PATH:/usr/local/go/bin
  5. Edit /etc/security/limits.conf as an administrator (e.g. sudo) and add the following lines, replacing {username} with your username:

    {username}  soft  nofile  8096
    {username}  hard  nofile  8096
  6. Logout and login to effect the changes above.

  7. Fork https://github.com/mattermost/mattermost-server

  8. Clone the Mattermost source code from your fork:

    export GITHUB_USERNAME=my_username
    mkdir -p $(go env GOPATH)/src/github.com/mattermost
    git clone https://github.com/$GITHUB_USERNAME/mattermost-server.git $(go env GOPATH)/src/github.com/mattermost/mattermost-server
  9. Start the server and test your environment:

    cd $(go env GOPATH)/src/github.com/mattermost/mattermost-server
    make run-server
    curl http://localhost:8065/api/v4/system/ping
    make stop-server

    If successful, the curl step will return a JSON object:

    {"AndroidLatestVersion":"","AndroidMinVersion":"","DesktopLatestVersion":"","DesktopMinVersion":"","IosLatestVersion":"","IosMinVersion":"","status":"OK"}

    Note: Browsing directly to http://localhost:8065/ will display a 404 Not Found until the web app is configured. See Web App Developer Setup and Mobile App Developer Setup for additional setup.