diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 0796ec2ff2..13b2a792cc 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -750,6 +750,10 @@ ln_s libexec/"name", bin The symlinks created by [`install_symlink`](https://rubydoc.brew.sh/Pathname#install_symlink-instance_method) are guaranteed to be relative. `ln_s` will only produce a relative symlink when given a relative path. +### Rewriting a script shebang + +In some cases, the formula goal is to install a script written in an interpreted language, such as Python or Perl, and use it as an executable. Homebrew provides utilities to rewrite the shebang of a script so its path matches the interpreter dependency. For example, the [`icdiff` formula](https://github.com/Homebrew/homebrew-core/blob/7beae5ab57c65249403699b2b0700fbccf14e6cb/Formula/icdiff.rb) uses such utility. + ### Handling files that should persist over formula upgrades For example, Ruby 1.9’s gems should be installed to `var/lib/ruby/` so that gems don’t need to be reinstalled when upgrading Ruby. You can usually do this with symlink trickery, or (ideally) a configure option.