From 95b19823b7a7c9dacf41301a18ab2e207e802c58 Mon Sep 17 00:00:00 2001 From: Matthew Heller Date: Tue, 10 Oct 2023 01:18:03 -0500 Subject: [PATCH 1/4] Tips-N'-Tricks: homebrew.man.conf for Terminal.app Add instructions for fixing Terminal.app's "Open man Page" command by creating homebrew.man.conf. --- docs/Tips-N'-Tricks.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/Tips-N'-Tricks.md b/docs/Tips-N'-Tricks.md index d13f571e78..32a02adc5f 100644 --- a/docs/Tips-N'-Tricks.md +++ b/docs/Tips-N'-Tricks.md @@ -104,3 +104,19 @@ $ brew install --cask --adopt textmate - [homebrew-mode](https://github.com/dunn/homebrew-mode) provides syntax highlighting for inline patches as well as a number of helper functions for editing formula files. - [pcmpl-homebrew](https://github.com/hiddenlotus/pcmpl-homebrew) provides completion for emacs shell-mode and eshell-mode. + +## Terminal.app: Enable the "Open man Page" contextual menu item + +In the macOS Terminal, you can right-click on a command name (like `ls` or `tar`) and pop open its manpage in a new window by selecting "Open man Page". + +Terminal needs an extra hint on where to find manpages installed by Homebrew because it doesn't load normal dotfiles like `~/.bash_profile` or `~/.zshrc`. + +```console +$ sudo mkdir -p /usr/local/etc/man.d +$ sudo nano /usr/local/etc/man.d/homebrew.man.conf +``` +Add the following to the new file `homebrew.man.conf`: +``` +### Homebrew +MANPATH /opt/homebrew/share/man +``` From 29b43e1dc98527d1f90711d87ba4f5875f47fe59 Mon Sep 17 00:00:00 2001 From: Matthew Heller Date: Tue, 10 Oct 2023 01:52:31 -0500 Subject: [PATCH 2/4] Fixes for the linter. --- docs/Tips-N'-Tricks.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/Tips-N'-Tricks.md b/docs/Tips-N'-Tricks.md index 32a02adc5f..e8205408f8 100644 --- a/docs/Tips-N'-Tricks.md +++ b/docs/Tips-N'-Tricks.md @@ -111,12 +111,15 @@ In the macOS Terminal, you can right-click on a command name (like `ls` or `tar` Terminal needs an extra hint on where to find manpages installed by Homebrew because it doesn't load normal dotfiles like `~/.bash_profile` or `~/.zshrc`. -```console -$ sudo mkdir -p /usr/local/etc/man.d -$ sudo nano /usr/local/etc/man.d/homebrew.man.conf +```sh +sudo mkdir -p /usr/local/etc/man.d +sudo nano /usr/local/etc/man.d/homebrew.man.conf ``` + Add the following to the new file `homebrew.man.conf`: -``` + +```sh ### Homebrew MANPATH /opt/homebrew/share/man ``` + From 26ee0bade10baddadc8ce346f806ecf709d87e46 Mon Sep 17 00:00:00 2001 From: Matthew Heller Date: Tue, 10 Oct 2023 01:55:32 -0500 Subject: [PATCH 3/4] Local linter didn't care about newline at EOF but CI did care... --- docs/Tips-N'-Tricks.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/Tips-N'-Tricks.md b/docs/Tips-N'-Tricks.md index e8205408f8..84e60918f6 100644 --- a/docs/Tips-N'-Tricks.md +++ b/docs/Tips-N'-Tricks.md @@ -122,4 +122,3 @@ Add the following to the new file `homebrew.man.conf`: ### Homebrew MANPATH /opt/homebrew/share/man ``` - From c7653f5570e88adbb513d98c8022d0ebc74007c6 Mon Sep 17 00:00:00 2001 From: Matthew Heller Date: Tue, 10 Oct 2023 12:00:50 -0500 Subject: [PATCH 4/4] Apply suggestions from code review Update instructions: Append to the file from the shell, and fix permissions if on macOS Intel. Co-authored-by: Mike McQuaid --- docs/Tips-N'-Tricks.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/Tips-N'-Tricks.md b/docs/Tips-N'-Tricks.md index 84e60918f6..5eac0dda85 100644 --- a/docs/Tips-N'-Tricks.md +++ b/docs/Tips-N'-Tricks.md @@ -105,7 +105,7 @@ $ brew install --cask --adopt textmate - [pcmpl-homebrew](https://github.com/hiddenlotus/pcmpl-homebrew) provides completion for emacs shell-mode and eshell-mode. -## Terminal.app: Enable the "Open man Page" contextual menu item +## macOS Terminal.app: Enable the "Open man Page" contextual menu item In the macOS Terminal, you can right-click on a command name (like `ls` or `tar`) and pop open its manpage in a new window by selecting "Open man Page". @@ -113,12 +113,11 @@ Terminal needs an extra hint on where to find manpages installed by Homebrew bec ```sh sudo mkdir -p /usr/local/etc/man.d -sudo nano /usr/local/etc/man.d/homebrew.man.conf +echo "MANPATH /opt/homebrew/share/man" | sudo tee -a /usr/local/etc/man.d/homebrew.man.conf ``` -Add the following to the new file `homebrew.man.conf`: +If you're using Homebrew on macOS Intel, you should also fix permissions afterwards with: ```sh -### Homebrew -MANPATH /opt/homebrew/share/man +sudo chown -R "${USER}" /usr/local/etc ```