# How to add OpenZeppelin compiler into truffle config as an external compiler?

**URL:** <https://forum.openzeppelin.com/t/how-to-add-openzeppelin-compiler-into-truffle-config-as-an-external-compiler/4455>\
**Category:** SDK\
**Created:** [November 7, 2020, 4:58pm UTC](https://forum.openzeppelin.com/t/how-to-add-openzeppelin-compiler-into-truffle-config-as-an-external-compiler/4455 "2020-11-07T16:58:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elliot](https://avatars.discourse-cdn.com/v4/letter/e/858c86/32.png) [@elliot](https://forum.openzeppelin.com/u/elliot)\
**Post date:** [November 7, 2020, 4:58pm UTC](https://forum.openzeppelin.com/t/how-to-add-openzeppelin-compiler-into-truffle-config-as-an-external-compiler/4455/1 "2020-11-07T16:58:27Z")

</div>

**💻 Environment**  
Dependecies:  
Truffle v5.1.45 - a development framework for Ethereum

Oz version:  
2.8.2

**📝Details**  
I am trying to get truffle compile to actually run the command oz compile --optimizer on so that truffle uses the oz compiler. However, I don’t want to just alias it in my terminal. I am trying to figure out how to do this with the compiler object in truffle. Any help would be appreciated.

**🔢 Code to reproduce**  
Current truffle compiler config:

```auto
       compilers: {
        external: {
          command: "oz compile --optimizer on",
          targets: [{
            "path": "./build/artifacts/*.json"
          }],
        },
      }

```

And it doesn’t use the oz compiler when I run the compile command

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [November 10, 2020, 5:11am UTC](https://forum.openzeppelin.com/t/how-to-add-openzeppelin-compiler-into-truffle-config-as-an-external-compiler/4455/2 "2020-11-10T05:11:18Z")

</div>

Hi @elliot,

Please note: **we’ve decided it’s best to focus our upgradeability efforts on the Upgrades Plugins exclusively, and have halted development on the OpenZeppelin CLI.** For details see:  
[Building for interoperability: why we’re focusing on Upgrades Plugins](https://forum.openzeppelin.com/t/building-for-interoperability-why-we-re-focusing-on-upgrades-plugins/4088)

* * *

I had a quick play with the Truffle configuration but didn’t get very far unfortunately.

> **[Truffle | Configuration | Documentation | Truffle Suite](https://www.trufflesuite.com/docs/truffle/reference/configuration#external-compilers)**
>
> The Truffle suite of tools make dapp development easier and more consistent.

* * *

I was curious as why you wanted to use the OpenZeppelin CLI for compiling in a truffle project?

---

<div class="post-metadata">

**Author:** ![elliot](https://avatars.discourse-cdn.com/v4/letter/e/858c86/32.png) [@elliot](https://forum.openzeppelin.com/u/elliot)\
**Post date:** [November 10, 2020, 8:02am UTC](https://forum.openzeppelin.com/t/how-to-add-openzeppelin-compiler-into-truffle-config-as-an-external-compiler/4455/3 "2020-11-10T08:02:47Z")

</div>

I solved the problem by turning on the optimizer in truffle and then I didn’t need to wire in the oz cli’s compiler to truffle.

---

<div class="post-metadata">

**Author:** ![abcoathup](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abcoathup/32/415_2.png) [@abcoathup](https://forum.openzeppelin.com/u/abcoathup)\
**Post date:** [November 10, 2020, 8:25am UTC](https://forum.openzeppelin.com/t/how-to-add-openzeppelin-compiler-into-truffle-config-as-an-external-compiler/4455/4 "2020-11-10T08:25:58Z")

</div>

Hi @elliot,

Glad to hear that you resolved.
