whatcable icon indicating copy to clipboard operation
whatcable copied to clipboard

[Feature] Write uk.whatcable into /private/etc/paths.d to Find whatcable CLI Executable File

Open MSSEsq opened this issue 4 months ago • 4 comments

What's the problem?

Creating a symbolic link in /usr/local/bin/ is considered a less preferred method of enabling a CLI executable file to be found in the search path.

What would you like to see?

Consistent with file naming conventions and the preferred method of supplementing the CLI search path, write, or recommend creating, in the /private/etc/paths.d directory, a file named uk.whatcable containing the path to the whatcable CLI executable file. The uk.whatcable file should only contain the path. Any white space in the path should not be escaped, and the path need not end with any special character, such as a slash, colon, or new line character. For example, if the WhatCable application is stored within the Utilities folder within a System Utilities folder, then the path specified in the uk.whatcable file would be: /Applications/Utilities/System Utilities/WhatCable/WhatCable.app/Contents/Helpers It should be noted that the /private/etc/paths.d directory is only writable by the Superuser (root), so privileges must be elevated by using the sudo command when writing the uk.whatcable file. Testing this configuration can be done by logging out and then logging in and running echo $PATH which will return the entire search path. Confirming that the whatcable executable file is being found on the search path can be done by running which whatcable which should return the entire pathname of the file.

Alternatives considered

No response

Anything else

No response

MSSEsq avatar Jul 15 '26 19:07 MSSEsq

Thanks for the detailed spec, it's exactly right, down to the unescaped whitespace, and paths.d is the cleaner method. One boundary though: WhatCable's rule is that it never asks for elevated privileges, and /etc/paths.d is root-only, so the app won't write the file itself. What I'll do is update the CLI docs to recommend your approach as the preferred manual method, with the exact file name and contents you describe, keeping the symlink as the works-immediately alternative and Homebrew as the no-thought route.

I'll close this when the docs update ships.

darrylmorley avatar Aug 12 '26 15:08 darrylmorley

I am glad that my suggestion was helpful. I had considered recommending a Unix shell script file programmed to be executed by the standard Bourne Shell (sh) for inclusion in the WhatCable.app/Contents/Helpers directory that when run would write an appropriate file to the /private/etc/paths.d directory. I did not do so because of concern about needing to request administrator credential to elevate privileges when running the script. If this possibility nevertheless seems attractive, then consider that

DirNm="`dirname "$0"`"

could be included in the script to set the correct pathname as a $DirNm variable to be written into the new file in the /private/etc/paths.d directory. That would enable the script to work properly if the WhatCable.app application bundle is stored within a subdirectory of an Applications directory, as in the example that I provided. This is just a supplementary suggestion. I understand if it is considered something that would violate the rule that WhatCable never asks for elevated privileges.

MSSEsq avatar Aug 13 '26 20:08 MSSEsq

@MSSEsq The catch with a script is the same as before: writing to /etc/paths.d needs admin rights, and WhatCable never asks for those. A script you run yourself with sudo would be fine though.

The docs update with your paths.d method as the preferred manual route hasn't shipped yet. I'll keep this open until it does.

darrylmorley avatar Oct 09 '26 09:10 darrylmorley

Fixed in v1.5.1.

darrylmorley avatar Nov 24 '26 10:11 darrylmorley