How to Install TypeScript on macOS (Homebrew and npm Guide)
Use this guide if you specifically need to install TypeScript on a Mac. If you want the cross-platform overview first, start with How to Install TypeScript on Windows, macOS, and Linux. For other operating systems, see the sibling guides for Windows and Linux.
Before You Start
TypeScript is distributed through npm, so the first job on macOS is to install Node.js. Most Mac users should either use Homebrew or the official Node.js installer.
Option 1: Install Node.js with Homebrew
If Homebrew is already installed, this is usually the fastest and cleanest path.
brew update
brew install node
node -v
npm -vIf you do not have Homebrew yet, install it first:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Option 2: Install Node.js with the Official Installer
Download the current LTS release from the official Node.js site, run the macOS package installer, then open a new Terminal window and verify the installation:
node -v
npm -vInstall TypeScript Globally
Once Node.js and npm are available, install the TypeScript compiler globally:
npm install -g typescript
tsc -vThis makes the tsc command available from any Terminal session.
Install TypeScript Per Project
If you want a project-local setup instead of a system-wide install, initialize a project and add TypeScript as a development dependency:
mkdir my-typescript-project
cd my-typescript-project
npm init -y
npm install --save-dev typescript
npx tsc --initThis approach is usually better for team projects because the TypeScript version is pinned in package.json.
Verify the Compiler
Create a simple test file and confirm the compiler works:
echo 'const message: string = "TurboGeek";' > hello.ts
tsc hello.ts
lsYou should now see a compiled JavaScript file next to your TypeScript source file.
Troubleshooting on macOS
npmornodenot found: close and reopen Terminal, then check your PATH.- Apple Silicon PATH issue: if Homebrew is installed under
/opt/homebrew, add it to your shell profile. - Permission errors: prefer Homebrew or a Node version manager rather than forcing
sudo npm install -g.
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zprofile
source ~/.zprofileRelated TypeScript Guides
- TypeScript install hub for all platforms
- How to Install TypeScript on Windows
- How to Install TypeScript on Linux
With Node.js and TypeScript installed, you can move on to creating a tsconfig.json, compiling your first project, or integrating TypeScript into an existing JavaScript codebase.

Recent Comments