From 1cd5d508a1f51e0672131f3dc34a5e905cc577e6 Mon Sep 17 00:00:00 2001 From: Caleb Xu Date: Tue, 19 May 2020 00:34:24 -0400 Subject: [PATCH] docs: mention that bin.install can rename file --- docs/Formula-Cookbook.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index c141675db5..ad2e3d6696 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -411,6 +411,12 @@ system "make", "install" You’ll see stuff like this in some formulae. This moves the file `foo` into the formula’s `bin` directory (`/usr/local/Cellar/pkg/0.1/bin`) and makes it executable (`chmod 0555 foo`). +You can also rename the file during the installation process. This can be useful for adding a prefix to binaries that would otherwise cause conflicts with another formula, or for removing a file extension. For example, to install `foo.py` into the formula's `bin` directory (`/usr/local/Cellar/pkg/0.1/bin`) as just `foo` instead of `foo.py`: + +```ruby +bin.install "foo.py" => "foo" +``` + ### `inreplace` [`inreplace`](https://rubydoc.brew.sh/Utils/Inreplace) is a convenience function that can edit files in-place. For example: