Install Homebrew Mac Catalina
Homebrew is an open-source package manager for macOS that offers an easy way to install software and tolls through the command line. If you are a coder, developer, Terminal lover, or more tech-savvy than an average Mac user, you can use Homebrew to simplify software installation on your Mac. Step 2: Install Node. By installing NodeJS you will also get NPM which is Node package manager. It will help you to install other packages. To install Node on your Mac using Homebrew type the following command. $ brew install node. Once you have Node installed you can check its version by typing the following command in the terminal.
In this tutorial we will learn to install TypeScript on Mac using NPM a NodeJS package manager.
Step 1: Install Homebrew
Homebrew is a package manager for Mac and helps to easily install and uninstall softwares on a Mac.
To install Homebrew run the following command in the terminal.
For more detail on Homebrew check their website.
Once you have homebrew installed on your system you can use it to install many packages.
Step 2: Install Node
By installing NodeJS you will also get NPM which is Node package manager. It will help you to install other packages.
To install Node on your Mac using Homebrew type the following command.
Once you have Node installed you can check its version by typing the following command in the terminal.
And, to check the version of NPM type the following command in the terminal.
Click here to read the tutorial on How to install NodeJS on Mac.
So, now we have Node and NPM installed on our system. Time to install TypeScript using NPM.
Step 3: Install TypeScript
We will install TypeScript globally on our Mac so that we can access it from any directory. For this we will use the following command.
You may have to use sudo
if you don't have permissions.
Output
Once you have TypeScript installed use the following command to check the version.
Output
Using TypeScript to convert .TS file into .JS file
Lets say, we have a project folder example and we have an app.ts TypeScript file which we want to convert into JavaScript file.
The content of app.ts file is given below.
Install Homebrew Mac Catalina
To convert app.ts file into app.js file we use the following command in the terminal.
Output
Uninstall TypeScript
To uninstall TypeScript globally we use the following command.
You may have to use sudo
if you don't have the permissions.
Output
How To Install Homebrew On Macos Catalina
And that's all for this tutorial. Have fun coding.