How do I make homebrew link an executable that exists under libexec?


(Connor Mc Arthur) #1

Hi,

I’m working on a new brew formula for a python project called dbt (data build tool). The formula, so far, can be found here: https://github.com/cmcarthur/homebrew-core/blob/add-dbt-formula/Formula/dbt.rb

The code for dbt is here: https://github.com/analyst-collective/dbt

After brew install dbt, I have a working executable at /usr/local/Cellar/dbt/0.5.4/libexec/bin/dbt, but not at /usr/local/bin/dbt.

Here’s what shows up after brew install dbt:

connor@connor ~ $ ls -al /usr/local/Cellar/dbt/0.5.4/
total 48
drwxr-xr-x  8 connor  wheel    272 Dec 20 16:34 .
drwxr-xr-x  3 connor  wheel    102 Dec 20 16:23 ..
drwxr-xr-x  3 connor  wheel    102 Dec 20 16:34 .brew
-rw-r--r--  1 connor  staff    284 Nov 29 01:35 CHANGELOG.md
-rw-r--r--  1 connor  staff    556 Dec 20 16:33 INSTALL_RECEIPT.json
-rw-r--r--  1 connor  staff  11357 Nov 29 01:35 License.md
-rw-r--r--  1 connor  staff   1306 Nov 29 01:35 README.md
drwxr-xr-x  8 connor  wheel    272 Dec 20 16:34 libexec

connor@connor ~ $ ls -al /usr/local/Cellar/dbt/0.5.4/libexec/
total 16
drwxr-xr-x   8 connor  wheel   272 Dec 20 16:34 .
drwxr-xr-x   8 connor  wheel   272 Dec 20 16:34 ..
lrwxr-xr-x   1 connor  wheel    71 Dec 20 16:34 .Python -> ../../../../opt/python3/Frameworks/Python.framework/Versions/3.5/Python
drwxr-xr-x  37 connor  wheel  1258 Dec 20 16:34 bin
drwxr-xr-x   4 connor  wheel   136 Dec 20 16:30 include
drwxr-xr-x   3 connor  wheel   102 Dec 20 16:24 lib
-rw-r--r--   1 connor  wheel    60 Dec 20 16:24 pip-selfcheck.json
drwxr-xr-x   3 connor  wheel   102 Dec 20 16:31 share

From other reading on these boards, it appears that anything inside libexec will not be linked into /usr/local/bin. Can I force that to happen somehow?


(Jonathan Chang) #2

Hi Connor,

You can use bin.install_symlink to get executables from libexec into bin. Feel free to search through other formula for some examples.


(Connor Mc Arthur) #3

Hey Jonathan, that worked perfectly. Thank you!

Fix can be viewed here: https://github.com/cmcarthur/homebrew-core/blob/add-dbt-formula/Formula/dbt.rb#L156