How to resolve "dyld: Library not loaded: @executable_path.." error
It is a bug with awscli and it might be fixed with the next versions. That's why, a best practices is to upgrade :
brew upgrade awscli
You must have messed up with the brew. Try reinstalling it using: brew install awscli
(followed by brew link awscli
if needed).
After read the topic, It works for me:
- Uninstall aws
$ sudo rm -rf /usr/local/aws
$ sudo rm /usr/local/bin/aws
- Reinstall it again
$ brew reinstall awscli
This error occurs because your virtual environment has broken symlinks.
Here is a nice solution taken from tevino's fix_virtualenv
gist:
#!/usr/bin/env bash
ENV_PATH="$(dirname "$(dirname "$(which pip)")")"
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)"
BAD_ENV_PATHS="/usr/local"
echo "Ensure the root of the broken virtualenv:"
echo " $ENV_PATH"
if [[ -z "$ENV_PATH" ]] || [[ "$ENV_PATH" = *"$BAD_ENV_PATHS"* ]]; then
echo "The root path above doesn't seems to be a valid one."
echo "Please make sure you ACTIVATED the broken virtualenv."
echo "‼️ Exiting for your safety... (thanks @laymonk for reporting this)"
exit 1
fi
read -p "‼️ Press Enter if you are not sure (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "♻️ Removing old symbolic links......"
find "$ENV_PATH" -type l -delete -print
echo "💫 Creating new symbolic links......"
$SYSTEM_VIRTUALENV "$ENV_PATH"
echo "🎉 Done!"
fi
Also, here is a similar question: Broken references in Virtualenvs.
I had similar issue while installing awscli with homebrew on mac. So final approach was "brew uninstall python3" and reinstall awscli again.