This question surprised me a bit - but I have no clue about where to locate my extension directory!!

Is there a simple way to reliably locate it (either programatically or via the UI)?

2 Answers 2


You can find your extension directory by going to Administer menu » System Settings » Directories and checking the value for the "Extensions" directory. If there's a token like [civicrm.root], you can determine its value with this technique.


In PHP it looks like this is what I need:

return (new CRM_Extension_System())->getDefaultContainer()->baseDir;

So in bash I can use cv:

cv ev 'return (new CRM_Extension_System())->getDefaultContainer()->baseDir'

or better still, as pointed out be Tim:

cv ev 'return CRM_Core_Config::singleton()->extensionsDir'

which means this one liner will take you to the directory:

cd `cv ev 'return CRM_Core_Config::singleton()->extensionsDir;' --out=pretty`
  • I happened to find this way as the simplest but if there is a non-programtic way that would be awesome! Jan 23, 2017 at 0:35
  • (1) That's a clever way. FWIW, the traditional PHP snippet find the default container is CRM_Core_Config::singleton()->extensionsDir;. (2) Coincidentally, I've been mulling a form of this problem in github.com/civicrm/cv/pull/14
    – Tim Otten
    Jan 23, 2017 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.