Clear Filters
Clear Filters

Getting "zsh:1: command not found: aws" when uploading data to Amazon S3 from Local MacOS Machine

24 views (last 30 days)
Hello,
I am using macOS 14.1.1 (23B81). I have downloaded and installed AWS Command Line Interface tool for MacOS, but when I use the command !aws or aws, I get the error:
zsh:1: command not found: aws
When I run aws --version on Terminal I get:
% aws --version
aws-cli/2.13.38 Python/3.11.6 Darwin/23.1.0 exe/x86_64 prompt/off
Any solutions or recommendations on how to troubleshoot this?

Answers (1)

Walter Roberson
Walter Roberson on 22 Nov 2023
When you start up an application from icon (or dock) in MacOS, the application runs as you, but it does not go through the standard login-steps. Any additions to the shell PATH that might be done during your login steps, are simply not done. So the PATH only has the (relatively few) entries that are created for all daemons -- usually /usr/bin:/bin:/usr/sbin:/sbin
You have several choices:
  • you can specify the full path to the executable when you use !, such as ! /homebrew/bin/aws --version
  • you can use a compound shell command that first adds in the required path, such as ! set -x PATH="$PATH:/homebrew/bin; aws --version
  • You can use setenv() instead of MATLAB to set the PATH environment variable before doing the !, such as setenv("PATH", string(getenv("PATH")) + ":/homebrew/bin")
  • You can modify the plist of the MATLAB executable to add the directory to PATH
  • You can modify the plist of MacOS to add the directory to PATH
  • You can explicitly invoke your favourite shell with the -l flag to indicate you want it to go through login procedures; for example, ! zsh -l -c "aws --version"

Categories

Find more on Manage Products in Help Center and File Exchange

Tags

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!