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.
Homebrew complements macOS (or your Linux system). Install your RubyGems with gem and their dependencies with brew. “To install, drag this icon” no more. Homebrew Cask installs macOS apps, fonts and plugins and other non-open source software. $ brew install -cask firefox. Making a cask is as simple as creating a formula. Installing Homebrew. First, we need to install Homebrew. Homebrew allows us to install and compile software packages easily from source. Homebrew comes with a very simple install script. When it asks you to install XCode CommandLine Tools, say yes. Open Terminal and run 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.
To convert app.ts file into app.js file we use the following command in the terminal.
Output
Mac Install Homebrew Catalina Free
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
And that's all for this tutorial. Have fun coding.
if you do not have brew installed on your mac, Install homebrew on your mac by running the following command on your Terminal.
Install kafka in MacOS Catalina
First install openjdk 8 using brew cask and then install kakfa.
When the installation completes, It will show you something like below
Start zookeeper & kafka as a service
Stop zookeeper & kafka service
If you do not want to run kafka & zookeeper as a service use below commands
If you face any error in starting kafka, you will have configure listeners in /usr/local/etc/kafka/server.properties config file,
uncomment and change the values like below
Check if kafka is functioning properly
Create test topic
Start kafka consumer console
Start kafka producer console
Install Homebrew Mac Os Catalina
Once the producer starts enter any message and press enter.