NOTE! You are browsing legacy documentation. For latest visit docs.nativescript.org.

NativeScript Angular

NativeScript Advanced Setup: macOS

This page contains a list of all system requirements needed to build and run NativeScript apps on macOS, as well as a guided walkthrough for getting these requirements in place. On macOS systems, you can use the NativeScript CLI to develop Android and iOS apps.

System Requirements

  • macOS High Sierra or later
  • The latest stable official release of Node.js (LTS) 10.x.
  • (Optional) Homebrew to simplify the installation of dependencies
  • For iOS development
    • Latest Xcode
    • Command-line tools for Xcode
    • xcodeproj ruby gem
    • CocoaPods
    • The six python package
  • For Android development
    • JDK 8 or later
    • Latest official release of Android SDK
    • Android Support Repository
    • (Optional) Google Repository
    • Android SDK Build-tools 28.0.3 or later

You must also have the following two environment variables setup for Android development:

  • JAVA_HOME
  • ANDROID_HOME

Advanced Setup Steps

Complete the following steps to setup NativeScript on your macOS development machine:

  1. Install Homebrew to simplify the installation process.

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  2. Install the latest Node.js (LTS) 10.x.

    brew update
    
    brew install node@10
    
    1. After you run the command above you will see this on console: If you need to have this software first in your PATH run: echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.bash_profile In order to make node available, please add it to path with this command: echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.bash_profile
      Then restart the terminal or run source ~/.bash_profile command.
  3. Install the dependencies for iOS development.

    1. Run the App Store and download Xcode.
    2. Start Xcode and you will be prompted to install Command Line Tools for Xcode.

      1. To verify that the installation is correct please run xcodebuild -version If command above do not pass then build tools are either not installed or not selected. You can select build tools via xcode-select command or via Xcode (Preferences -> Locations -> Command Line Tools).
    3. Install the xcodeproj ruby gem with the following command.

      sudo gem install xcodeproj
      
    4. Install CocoaPods

      sudo gem install cocoapods
      
    5. Setup CocoaPods

      pod setup
    6. Install pip

      sudo easy_install pip
    7. Install python six package

      pip install six
      
  4. Install the dependencies for Android development.

    1. Set up JDK 8.
    brew tap AdoptOpenJDK/openjdk
    
    brew install --cask adoptopenjdk8
    
    1. Set the JAVA_HOME system environment variable.

      export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
      
    2. Install the Android SDK.

      1. In the terminal, run the following command:

        brew install --cask android-sdk
        
      2. Next, run the following command to set the ANDROID_HOME system environment variable:

        export ANDROID_HOME=/usr/local/share/android-sdk
        
        NOTE: : If you are installing via Android SDK Manager, then the path for ANDROID_HOME would be '/Users/$userid/Library/Android/sdk/' .
        NOTE: This is the directory that contains the tools and platform-tools directories.
        NOTE: In order to persist these variables after your terminal session is closed, they have to be persisted in your shell profile file (e.g. ~/.bash_profile if you are using Bash, ~/.zprofile if you are using Zsh)
      3. In addition, install all packages for the Android SDK Platform 28, Android SDK Build-Tools 28.0.3 or later, Android Support Repository, Google Repository and any other SDKs that you may need. You can alternatively use the following command, which will install all required packages.

        $ANDROID_HOME/tools/bin/sdkmanager "tools" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository"
        

        If you are behind a corporate proxy, it might be necessary to pass additional arguments. You can check sdkmanager documentation

  5. Setup Android Emulators (AVD) by following the article here

  6. Install the NativeScript CLI.

    1. Run the following command.

      npm i -g nativescript
      
    2. Restart the command prompt.

  7. To check if your system is configured properly, run the following command.

    tns doctor
    

If you see "No issues were detected" you are good to go!

NativeScript tns doctor result

What’s Next