.profile.d Scripts

Last Updated: 03 November 2014

Table of Contents

During startup, the container starts a bash shell that runs scripts in the .profile.d/ directory before executing the dyno’s command.

These scripts let you manipulate the initial environment, at runtime, for all dyno types in the app - an application can gain explicit control over its startup environment. Buildpacks can use these scripts to set up a default environment.

The scripts must be bash scripts, and their filenames must end in .sh.

If you have questions about the build process on Heroku, consider discussing it in the Build forums.

Example .profile.d/path.sh

.profile.d scripts are sourced after the app’s config vars are added to the environment. To have the app’s config vars take precedence, use a technique like that shown here with LANG.

# add vendor binaries to the path

# set a default LANG if it does not exist in the environment

If you find yourself making frequent changes to your .profile.d scripts, you should probably be using config vars.


Scripts in the .profile.d/ directory will be executed in an arbitrary order.