Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»MacOS»How to Install Angular CLI on macOS

    How to Install Angular CLI on macOS

    RahulBy RahulAugust 4, 20192 Mins ReadUpdated:March 6, 2020

    This tutorial will help you to install Angular.js on your macOS operating system via command line. You must need to install Homebrew package manager on your macOS.

    Step 1 – Prerequsities

    Let’s start the installation of Node.js on your macOS system using Homebrew. So first update the Homebrew package manager index. Then you can install Node.js package in your MacOS system using the following command:

    brew update  
    brew install node
    

    You have successfully installed Node.js on your system. Execute below command on the terminal to view the installed Node.js version info.

    node -v
    
    v12.4.0
    

    Step 2 – Install Angular/CLI on macOS

    After installing the Node.js and npm on your system, use the following commands to install the Angular CLI tool on your system globally.

    npm install -g @angular/cli
    

    This command will install the latest available Angular CLI version on your macOS system. If you need any other Angular version on your macOS use one of the following commands as per required version.

    npm install -g @angular/[email protected]6     #Angular 6
    npm install -g @angular/[email protected]7     #Angular 7
    npm install -g @angular/[email protected]8     #Angular 8
    npm install -g @angular/[email protected]9     #Angular 9
    

    Using the -g above command will install the Angular CLI tool globally. So it will be accessible to all users and applications on the system. Angular CLI provides a command ng used for command-line operations. Let’s check the installed version of ng on your system.

    ng --version
    

    install angularjs on macos

    Step 3 – Create New Angular Application

    Now, create a new application named hello-angular4 using the Angular CLI tools. Execute the commands to do this:

    ng new hello-angular4
    

    Output:

    ...
    ...
    added 1011 packages from 1041 contributors and audited 19005 packages in 55.774s
    found 0 vulnerabilities
    
        Successfully initialized git.
    

    This will create a directory named hello-angular4 in your current directory, and create an application.

    Step 4 – Serve Angular Application

    Your basic Angular application is ready to serve. Change directory to hello-angular4 and run your Angular application using ng serve command.

    cd hello-angular4
    ng serve
    

    You can access your angular application on localhost port 4200, Which is the default host and port used by Angular application.

    • http://localhost:4200


    You can change host and port for running Angular application by providing –host and –port command line arguments.

    ng serve --host 0.0.0.0 --port 8080
    

    The IP address 0.0.0.0 listens on all interfaces and publically accessible.

    Angular Angular-cli Angularjs macOS
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to use Comments in JSON
    Next Article How to Test TLS version used for PHP

    Related Posts

    How to Install Angular CLI on Ubuntu 22.04

    4 Mins Read

    How to Install AnyDesk on macOS

    Updated:December 11, 20202 Mins Read

    How to Check MacOS Version (GUI+CLI)

    Updated:May 21, 20222 Mins Read

    How to Install Yarn on MacOS

    3 Mins Read

    How To Install NVM on macOS with Homebrew

    Updated:June 8, 20222 Mins Read

    How to Check Angular Version (Application+CLI)

    Updated:November 6, 20202 Mins Read

    3 Comments

    1. Peter on March 1, 2021 7:05 am

      or use:
      brew install angular-cli

      Reply
    2. j on September 20, 2020 2:29 am

      I have been trying to angular cli installed on mac os but it keeps coming up with command not found: ng. Below are notes from what I followed in this guide and it seems like everything should have loaded but I still get command not found. This seems like it could be more of an issue with npm or something but I don’t know how to fix it. Do you have any steps for how to resolve this so that ng will run?

      @Macs-Mac ~ % brew -v
      Homebrew 2.5.0
      Homebrew/homebrew-core (git revision d1c83d; last commit 2020-09-12)
      @Macs-Mac ~ % node -v
      v12.18.3
      @Macs-Mac ~ % npm install -g @angular/cli
      npm WARN deprecated [email protected].2: request has been deprecated, see https://github.com/request/request/issues/3142
      npm WARN deprecated [email protected]: this library is no longer supported
      /Users//npm-global/bin/ng -> /Users//npm-global/lib/node_modules/@angular/cli/bin/ng

      > @angular/[email protected] postinstall /Users//npm-global/lib/node_modules/@angular/cli
      > node ./bin/postinstall/script.js

      + @angular/[email protected]
      updated 1 package in 8.494s

      @Macs-Mac ~ % ng -v
      zsh: command not found: ng

      @Macs-Mac ~ % cd /Users//npm-global/lib/node_modules/@angular/cli/bin
      @Macs-Mac bin % ls
      ng postinstall

      Reply
      • nabil on January 18, 2021 2:59 pm

        download the latests version

        Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    • How to Install Angular CLI on Ubuntu 22.04
    • How to Install Composer on Ubuntu 22.04
    • How to Create DMARC Record For Your Domain
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.