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

Add Homebrew path for Apple Silicon #71

Closed indiependente closed 1 year ago

indiependente commented 2 years ago

Issue

When executed as a service on macOS on an Apple Silicon machine, the script is not able to find the brew binary due to it being located under /opt/homebrew/bin/.

Proof of this is visible in the /tmp/homebrew.mxcl.aws-rotate-iam-keys.log log file:

➜  ~ cat /tmp/homebrew.mxcl.aws-rotate-iam-keys.log
GNU's enhanced getopt is required to run this script
You can usually find this in the util-linux package
On MacOS see homebrew's package: http://brewformulas.org/Gnu-getopt
For anyone else, build from source: http://frodo.looijaard.name/project/getopt

The output can be misleading because it fails on the first part of the if condition where it tries to identify the brew binary but fails.

Hence the script won't work if scheduled as a service.

Solution

Adding the Apple Silicon Homebrew binary path to the Plist file in the Environment variables section fixes the problem.

mmrwoods commented 1 year ago

Fixed by #76