3

I have at least one application that is installing executables in another folder than its {{prefix}}/bin, one like {{[prefix}}/libexec/mc/mcwrapper.sh.

I know that brew does symlink all the files from bin/ automatically, without needing any configuration. Check brew edit mc and you will not see any code for creating the symlinks.

Now the question is how do I tell mc to also symlink few other scripts so I can have them in the path?

sorin
  • 161,544
  • 178
  • 535
  • 806

1 Answers1

2

Formulas are Ruby scripts and you can use ln_s or ln_sf methods to create symlinks.

ln_s SOURCE, "#{HOMEBREW_PREFIX}/some/custom/target", :force => true

or shorter using using alias ln_sf

ln_sf SOURCE, "#{HOMEBREW_PREFIX}/some/custom/target"

Replace SOURCE with your file or directory you want to symlink.

From the Ruby docs:

ln_s(old, new, options = {})

Creates a symbolic link new which points to old. If new already exists and it is a directory, creates a symbolic link new/old. If new already exists and it is not a directory, raises Errno::EEXIST. But if :force option is set, overwrite new.

dafyk
  • 1,042
  • 12
  • 24