Skip to content

How to install the AWS CDK on macOS

This post lists the steps needed to install the latest version of AWS CDK on macOS.

Apple Command Line Tools

xcode-select --install

Nvm

nvm is node.js version manager.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash

Close and reopen terminal.

Node.js

Install via nvm:

nvm install v20.16.0

Make sure you do not have default node set:

nvm unalias default

Activate node 20.16.0:

nvm use 20.16.0

Configure npm

Configure npm (Node Package Manager) to save versions of packages in packages.json. This way you can have the same stable environment on all development machines:

npm config set save=true
npm config set save-exact=true

AWS CDK

Install the AWS CDK globally (so that you can bootstrap a new CDK project in your language choice) in any folder:

nvm use 20.16.0

npm uninstall --global aws-cdk
npm install --global aws-cdk@2.111

Test:

cdk --version