rhyeal / aws-rotate-iam-keys

Rotate your IAM Keys to be in compliance with security best practices
GNU General Public License v3.0
339 stars 132 forks source link

Brew service's PATH lacks bin dir on Apple Silicon #67

Closed spencerwilson closed 2 years ago

spencerwilson commented 2 years ago

Symptom

The launchd service that ships with Homebrew formula 0.9.8.4 fails when run. Its logs indicate:

% cat /tmp/homebrew.mxcl.aws-rotate-iam-keys.log
/bin/bash: aws-rotate-iam-keys: command not found

Note: This is a distinct issue from #66 .

Fix

This is because Homebrew (on Apple Silicon Macs only) installs formula to /opt/homebrew,[^why] which is not on PATH when the service runs.

Fix for existing Apple Silicon Homebrew (default dir) installations:

patch "$(brew --prefix aws-rotate-iam-keys)/homebrew.mxcl.aws-rotate-iam-keys.plist" <<EOF
8c8
<     <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
---
>     <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
EOF

brew services restart aws-rotate-iam-keys

[^why]: Rationale: Short is https://docs.brew.sh/FAQ#why-is-the-default-installation-prefix-opthomebrew-on-apple-silicon, longer is here: https://www.reddit.com/r/MacOS/comments/jw9guu/why_did_homebrew_move_from_usrlocalto_opthomebrew/)

Fixed by #62 Fixed by #63

therealrawal commented 2 years ago

any updates on this?

mmrwoods commented 2 years ago

Sorry for the delay in following up on this, should be fixed now after merging #63