# If i modify source code, how to re-package or compile?

**URL:** <https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307>\
**Category:** Troubleshooting\
**Created:** [July 10, 2018, 4:32am UTC](https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307 "2018-07-10T04:32:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bje](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@bje](https://forum.mattermost.com/u/bje)\
**Post date:** [July 10, 2018, 4:32am UTC](https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307/1 "2018-07-10T04:32:21Z")

</div>

Hi, guys!

I want to know that how to re-package or compile source code.

in my case,

I already modified web/handlers.go file

so, i want to re-package or compile sourcec

if anyone know that method, let me know how to figure out

thanks for sincerely

---

<div class="post-metadata">

**Author:** ![bje](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@bje](https://forum.mattermost.com/u/bje)\
**Post date:** [July 10, 2018, 8:08am UTC](https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307/2 "2018-07-10T08:08:38Z")

</div>

so, i find use “make package” command for make mattermost.exe file …

when i use “make package” in /mattermost/mattermost-server/ folder

i got some error, the error is…

```
Packaging mattermost
rm -Rf dist
mkdir -p dist/mattermost/bin
mkdir -p dist/mattermost/logs
cp -RL config dist/mattermost
cp -RL fonts dist/mattermost
cp -RL templates dist/mattermost
cp -RL i18n dist/mattermost
sed -i'' -e 's|"ConsoleLevel": "DEBUG"|"ConsoleLevel": "INFO"|g' dist/mattermost/config/config.json
sed -i'' -e 's|"SiteURL": "http://localhost:8065"|"SiteURL": ""|g' dist/mattermost/config/config.json
sed -i'' -e 's|"SendEmailNotifications": true,|"SendEmailNotifications": false,|g' dist/mattermost/config/config.json
sed -i'' -e 's|"FeedbackEmail": "test@example.com",|"FeedbackEmail": "",|g' dist/mattermost/config/config.json
sed -i'' -e 's|"SMTPServer": "dockerhost",|"SMTPServer": "",|g' dist/mattermost/config/config.json
sed -i'' -e 's|"SMTPPort": "2500",|"SMTPPort": "",|g' dist/mattermost/config/config.json
mkdir -p dist/mattermost/client
cp -RL ../mattermost-webapp/dist/* dist/mattermost/client
cp build/MIT-COMPILED-LICENSE.md dist/mattermost
cp NOTICE.txt dist/mattermost
cp README.md dist/mattermost
cp /Users/username/go/bin/mattermost dist/mattermost/bin # from native bin dir, not cross-compiled
cp /Users/username/go/bin/platform dist/mattermost/bin # from native bin dir, not cross-compiled
cp: /Users/username/go/bin/platform: No such file or directory
make: *** [package] Error 1

```

if anyone know solutions, let me know that how to fix it?

thanks!

---

<div class="post-metadata">

**Author:** ![raul03ma](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@raul03ma](https://forum.mattermost.com/u/raul03ma)\
**Post date:** [July 10, 2018, 10:20am UTC](https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307/3 "2018-07-10T10:20:49Z")

</div>

I´m in the same case. I have read the documentation but i haven´t found anything. There are some guys that modify the makefile for linux version, but they do for version 3.5.1.

> [@Build / Package my version of Mattermost for Linux only](https://forum.mattermost.com/t/build-package-my-version-of-mattermost-for-linux-only/2675):
>
> Hello, I’m running Mattermost 3.5.1 on an Amazon EC2 instance and I have made some modifications on Mattermost source code (locally, not in the EC2 instance) in order to send usage statistics to New Relic. I tested my version using make run and everything goes fine (it works as expected), but now I want to build / package this source code to replace the code running on my EC2 instance. In short: seems to me that I just need to replace /opt/mattermost/bin/platform file, is it correct? If so, I …

Anybody know the official way for version 5?

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [July 10, 2018, 11:22pm UTC](https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307/4 "2018-07-10T23:22:04Z")

</div>

Hi @bje and @raul03ma, thank you for reaching out.

Here is a documentation that might help you get started: [https://developers.mattermost.com/contribute/getting-started/](https://developers.mattermost.com/contribute/getting-started/).

If this doesn’t help, just let me know and I’ll ask our engineers for further directions.

---

<div class="post-metadata">

**Author:** ![raul03ma](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@raul03ma](https://forum.mattermost.com/u/raul03ma)\
**Post date:** [July 11, 2018, 10:47am UTC](https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307/5 "2018-07-11T10:47:23Z")

</div>

Hi @amy.blais,

But if I understood well this is the way to install in a development environment with docker. But if I want to install in a production server, is the same way? I think the mattermost-server project should have a way to compile as a dist. I found a folder in this path mattermost-server/dist/mattermost that I think is what I want but I´m not sure. The only strange thing is the platform folder is empty and it shouldn´t.

Thanks a lot!!!

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [July 11, 2018, 6:52pm UTC](https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307/6 "2018-07-11T18:52:03Z")

</div>

Hi @raul03ma! Thank you for your question.

Would you like to join our [Peer-to-peer Help channel](https://pre-release.mattermost.com/core/channels/peer-to-peer-help) in our [build server](https://pre-release.mattermost.com/signup_user_complete/?id=f1924a8db44ff3bb41c96424cdc20676) to see if other community members would have ideas?

A lot of people in the community compile it themselves and they should have some ideas on how you can proceed.

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [July 11, 2018, 7:04pm UTC](https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307/7 "2018-07-11T19:04:40Z")

</div>

@raul03ma - One community member just shared an example of how he is packaging Mattermost for Arch Linux: [https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=mattermost](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=mattermost) !

I originally posted about this in [Developer Toolkit channel](https://pre-release.mattermost.com/core/pl/sejiocuxstdk7npdjmuoh6abhh), so you can follow that thread for any other ideas that people might share.

---

<div class="post-metadata">

**Author:** ![raul03ma](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@raul03ma](https://forum.mattermost.com/u/raul03ma)\
**Post date:** [July 23, 2018, 9:22am UTC](https://forum.mattermost.com/t/if-i-modify-source-code-how-to-re-package-or-compile/5307/8 "2018-07-23T09:22:21Z")

</div>

Thank you very much, i am going to visit this links.
