Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»MacOS»How to Install Angular CLI on macOS

    How to Install Angular CLI on macOS

    By RahulMarch 6, 20202 Mins Read

    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.

    Advertisement

    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

    Related Posts

    How to Install Postgres on MacOS

    How To Install PostgreSQL on MacOS

    How to Change Terminal Font Size in macOS

    How to Install LibreOffice on Mac

    How to Install LibreOffice on macOS

    View 3 Comments

    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

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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