Aws-sam-cli: Homebrew install/upgrade on MacOS breaks sam-cli

Created on 8 Jul 2020  路  3Comments  路  Source: aws/aws-sam-cli

Description

On an upgrade or new installation of aws-sam-cli via homebrew, sam --version (and any other sam commands) fails with the error

dyld: Library not loaded: @executable_path/../.Python Referenced from: /usr/local/Cellar/aws-sam-cli/0.53.0/libexec/bin/python3.7 Reason: image not found

This seems to have something to do with homebrew upgrading Python3 to version 3.8 on any upgrade or install, while sam-cli is looking for specifically version 3.7.

In my case, this happened from trying to upgrade my sam-cli version via brew upgrade aws-sam-cli, but the same issue seems to occur on a new installation via homebrew.

Steps to reproduce

Install (or upgrade) aws-sam-cli via homebrew, as per the instructions at https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-mac.html. Run sam --version, or any other sam-cli command.

Observed result

dyld: Library not loaded: @executable_path/../.Python Referenced from: /usr/local/Cellar/aws-sam-cli/0.53.0/libexec/bin/python3.7 Reason: image not found

Expected result

sam --version displays sam-cli version, sam-cli commands work.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: macOS Mojave 10.14.6
  2. sam --version: 0.53.0
  3. homebrew version: 2.4.4-36-gd1f6296

Most helpful comment

There is a workaround provided here: https://github.com/aws/homebrew-tap/issues/93

Specifically: brew install --build-from-source aws-sam-cli. This will not use the bottle. This will however take much longer to install.

All 3 comments

is there anyway to use a previous version of aws-sam-cli until this is fixed? it seems like only the latest version is available via homebrew

There is a workaround provided here: https://github.com/aws/homebrew-tap/issues/93

Specifically: brew install --build-from-source aws-sam-cli. This will not use the bottle. This will however take much longer to install.

Thanks for the workaround, I'm back in business.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rhlsthrm picture rhlsthrm  路  4Comments

chestongo picture chestongo  路  3Comments

terlar picture terlar  路  3Comments

dschu-lab picture dschu-lab  路  3Comments

Caian picture Caian  路  3Comments