Brew keg-only: which shell profile to use?

When installing some homebrew applications, such as openssl, it gets installed as keg-only, this is without creating a symlink to /usr/local/bin/. I need to use some features of this package for another application.

Normally it’s sufficient to add the PATH export to the shell profile file:

echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bashrc

But this is not working for the script step, the file is not read, nor ~/.profile or ~/.bash_login files are read. Also, other steps don’t seem to use the PATH location from the profile file, such as the yarn step.

Have thought about creating the symlink manually, but this would overwrite the PATH precedence from the system.

What is the recommended way to handle such situations like updating the PATH to be picked up by other tools?

Hi @gc1! Sorry for the delay in responding. This just made it to my queue today.

So if you’re trying to install homebrew applications, updating ~/.bashrc isn’t going to work. Our stacks use newer versions of MacOS which use Zsh by default. So you’d want to update / create ~/.zshrc

Regarding environment variables in general? We expose them using an internal tool called envman to expose them. Here’s some more information about that:

Matthew
Senior Customer Engineer

Thanks for your replay @matthew.jones.

envman seems like a nice tool, being the recommended way it’s worth looking into.

FWIW, as a workaround, we ended up using a symlink pointing from the application binary to /usr/local/bin/.

Regards

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.