Sam Install No Homebrew

aws sam homebrew cli lambda

The instructions to install SAM on the AWS site uses Homebrew. I use MacPorts locally on my Macbook and not much of a fan of Homebrew. The following explains how I install SAM for local Lambda development without Homebrew.

Install python39 with macports

1
sudo port install python39

Create a Python virtual environment

1
2
3
mkdir -p ~/apps
python3.9 -m venv ~/apps/python-aws-sam
source ~/apps/python-aws-sam/bin/activate

Once in your virtual environment, use pip to install SAM

1
pip install aws-sam-cli

Create a symlink to execute sam

1
2
mkdir -p ~/bin
ln -s ~/apps/python-aws-sam/bin/sam ~/bin/sam

I have something similar to the following in my .zshrc file so it can see what’s in my bin folder

1
export PATH="${HOME}/bin