How to Install TypeScript on MacOS

Ready to enhance your JavaScript development with TypeScript on your Mac? This guide provides clear instructions on how to install TypeScript on macOS, using either the official installer or the Homebrew package manager. Get started with TypeScript and improve your development workflow today.

This guide provides a step-by-step walkthrough of installing TypeScript on your macOS machine.

How to Install TypeScript on macOS

Step 1: Install Node.js

You have two options for installing Node.js:

Option 1: Using the Installer

  • Download Node.js: Visit the official Node.js website (https://nodejs.org) and download the latest Long Term Support (LTS) version for macOS.
  • Run the Installer: Double-click the downloaded package file and follow the installation wizard.

Option 2: Using Homebrew

  • Install Homebrew (if you don’t have it): Open Terminal and run the following command:
Bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Install Node.js LTS: In Terminal, run:
Bash
 brew install node@lts
  • Add Node.js to PATH (if needed):
    • Open your shell configuration file (.zshrc or .bashrc) in a text editor.
    • Add the following line at the end of the file:
Bash
export PATH="/usr/local/opt/node@lts/bin:$PATH"
  • Save the file.
  • Restart Terminal or run source ~/.zshrc (or source ~/.bashrc).

Verify Node.js Installation:

  • In Terminal, type node -v and press Enter. This should display the installed Node.js version.
Bash
node -v 

Step 2: Install TypeScript

  • Open Terminal: If you closed it, open a new Terminal window.
  • Install TypeScript Globally: Run the following command:
Bash
npm install -g typescript
  • Verify TypeScript Installation:
    • In Terminal, type tsc -v and press Enter to display the installed TypeScript version.

Step 3: (Optional) Update TypeScript

To update to a newer version of TypeScript in the future, run:

Bash
npm update -g typescript

That’s it! You’ve successfully installed TypeScript on your macOS machine and are ready to start developing!

Elsewhere On TurboGeek:  How to Install TypeScript on Windows

Richard.Bailey

Richard Bailey, a seasoned tech enthusiast, combines a passion for innovation with a knack for simplifying complex concepts. With over a decade in the industry, he's pioneered transformative solutions, blending creativity with technical prowess. An avid writer, Richard's articles resonate with readers, offering insightful perspectives that bridge the gap between technology and everyday life. His commitment to excellence and tireless pursuit of knowledge continues to inspire and shape the tech landscape.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Translate »