How to Install AWS Elastic Beanstalk CLI on Mac: Complete Tutorial
By Braincuber Team
Published on April 6, 2026
Building and deploying web applications to the cloud can feel overwhelming, especially when you need to manage infrastructure, environments, and deployment pipelines. AWS Elastic Beanstalk simplifies this process by providing a managed platform for deploying applications, and the Elastic Beanstalk CLI (EB CLI) gives you the power to control everything directly from your Mac terminal.
Elastic Beanstalk is an orchestration service that allows users on the AWS platform to deploy web applications easily. It caters to any setup you might need to run an application in the cloud. Orchestration simply means that it automates the workflow processes that occur in order to deliver resources as a service on the cloud. In this complete tutorial, we will walk through the simple steps to set Elastic Beanstalk up locally so you can interact directly with AWS from the terminal and push your deployed applications to the cloud via the commands provided by EB.
What You'll Learn:
- What AWS Elastic Beanstalk is and why it simplifies cloud deployment
- Benefits of using Elastic Beanstalk for application deployment
- How to clone the official EB CLI setup repository
- Installing and configuring zlib and other required dependencies
- Setting up environment variables and PATH for EB CLI
- Running the bundled installer and verifying the installation
- Initializing your first Elastic Beanstalk application with eb init
What is AWS Elastic Beanstalk?
AWS Elastic Beanstalk is a fully managed service that helps you deploy, manage, and scale applications on AWS. It takes care of provisioning the required resources, such as EC2 instances, RDS databases, and load balancers. The Elastic Beanstalk CLI is a command line interface that allows users to create, setup, and manage processes on Elastic Beanstalk directly from your terminal.
Data Persistence
Elastic Beanstalk allows your data to persist after the elastic cloud compute instance is terminated. Data stored on the volume remains accessible even after instance shutdown.
High Availability
Helps you avoid component failure by offering high availability and durability. Your applications stay running even when individual components experience issues.
Terminal Control
The EB CLI lets you manage your entire deployment lifecycle from the command line, enabling faster workflows and automation through scripts.
Auto-Scaling Support
Automatically scales your application based on traffic patterns, ensuring optimal performance and cost efficiency without manual intervention.
How to Install the Elastic Beanstalk CLI on Mac
To install EB CLI in our local environment, we need to use the open-source aws-elastic-beanstalk-cli-setup project from GitHub. This official repository provides installation guides and scripts to help with the process. Follow this step by step guide carefully to ensure a successful installation.
Clone the EB CLI Setup Repository
Open your Mac terminal and clone the official AWS Elastic Beanstalk CLI setup repository to your local environment. This repository contains all the scripts and configurations needed for installation.
Install Required Dependencies with Homebrew
Download and configure zlib, openssl, and readline using Homebrew. Zlib is a compression library that EB leverages when it needs to compress and decompress data, strings, structured in-memory content, or files.
Export and Configure Environment Variables
Export and setup paths for the environment variables for zlib. This ensures the compiler can find the required libraries during the installation process.
Run the Bundled Installer
Navigate back to the terminal where you pulled the repository and run the bundled installer script. This will compile and install the EB CLI with all necessary dependencies.
Add EB and Python to Environment PATH
Add the eb executable and python paths to your environment PATH by updating your bash profile. This allows you to run eb commands from any terminal location.
Verify Installation with eb init
Initialize an Elastic Beanstalk application to verify the installation. You should see a list of AWS regions to choose from, confirming that EB CLI is properly installed and configured.
git clone https://github.com/aws/aws-elastic-beanstalk-cli-setup.git
brew install zlib openssl readline
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib"
export LDFLAGS=$LDFLAGS:-L/usr/local/opt/zlib/lib
export CPPFLAGS=$CPPFLAGS:-I/usr/local/opt/zlib/include
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:~/usr/local/opt/zlib/lib/pkgconfig
# Verify paths were set correctly
echo $LDFLAGS $CPPFLAGS $PKG_CONFIG_PATH
Verify Environment Paths
After exporting the environment variables, always run the echo command to verify that paths were correctly set. If the output is empty, the variables were not exported properly and the installer will fail.
cd aws-elastic-beanstalk-cli-setup
./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
echo 'export PATH="/Users/user/.ebcli-virtual-env/executables:$PATH"' >> ~/.bash_profile && source ~/.bash_profile
echo 'export PATH=/Users/user/.pyenv/versions/3.7.2/bin:$PATH' >> ~/.bash_profile && source ~/.bash_profile
Update Your Username in PATH
Replace /Users/user/ with your actual Mac username in the PATH export commands above. You can find your username by running whoami in the terminal.
eb init
After running eb init, you should see a list of AWS regions that you can choose from. This confirms that the Elastic Beanstalk CLI is properly installed and ready to use. You can now interact with AWS from your terminal and add your credentials from an S3 bucket on AWS. You can also run other EB commands such as eb create, eb deploy, and many more.
| EB CLI Command | Purpose | Example Usage |
|---|---|---|
| eb init | Initialize EB application | eb init -p node.js my-app |
| eb create | Create new environment | eb create production-env |
| eb deploy | Deploy application code | eb deploy |
| eb status | Check environment status | eb status |
| eb logs | View application logs | eb logs --last 100 |
# Initialize with specific platform
eb init -p node.js my-application
# Create a new environment
eb create my-environment
# Deploy latest code changes
eb deploy
# Open application in browser
eb open
# View environment status
eb status
# Tail logs in real-time
eb logs --follow
Frequently Asked Questions
How do I install AWS Elastic Beanstalk CLI on Mac?
Clone the aws-elastic-beanstalk-cli-setup repository from GitHub, install zlib and dependencies via Homebrew, export environment variables, run the bundled installer, and add eb to your PATH.
What is zlib and why is it needed for EB CLI?
Zlib is a compression library used for data compression and decompression. EB CLI leverages zlib when compressing application code for deployment to AWS Elastic Beanstalk environments.
How do I verify EB CLI is installed correctly?
Run eb init in your terminal. If installed correctly, you will see an interactive prompt listing AWS regions to choose from, confirming the CLI is working properly.
What is the difference between eb create and eb deploy?
eb create provisions a new Elastic Beanstalk environment with all required infrastructure. eb deploy uploads your latest application code to an existing environment without recreating infrastructure.
Can I use EB CLI with zsh instead of bash on Mac?
Yes. Since macOS Catalina uses zsh as the default shell, add the PATH exports to ~/.zshrc instead of ~/.bash_profile and run source ~/.zshrc to apply changes.
Ready to Deploy Your Applications to AWS?
Congratulations! You have successfully installed the AWS Elastic Beanstalk CLI on your Mac. Now you can deploy, manage, and scale your applications directly from the terminal with full cloud orchestration capabilities.
Remember that Elastic Beanstalk handles the infrastructure complexity while you maintain control over your application code and configuration. Start with simple deployments and gradually explore advanced features like auto-scaling and load balancing.
