NativeScript Advanced Setup: Linux

This page contains a list of all system requirements needed to build and run NativeScript apps on Linux, as well as a guided walkthrough for getting these requirements in place.

NOTE: On Linux systems you can only use the NativeScript CLI to develop Android apps. This is because the NativeScript CLI uses Xcode to build iOS apps, which is only available on the macOS operating system. If you’re interested in building iOS apps on Linux, you may want to try out the public preview of NativeScript Sidekick. NativeScript Sidekick provides robust tooling for NativeScript apps, including a service that performs iOS and Android builds in the cloud, removing the need to complete these system requirements, and allowing you to build for iOS on Linux.

System Requirements

  • Ubuntu 14.04 LTS
  • The latest stable official release of Node.js (LTS) 6.x
  • G++ compiler
  • JDK 8
  • Android SDK 22 or a later stable official release
  • Android Support Repository
  • (Optional) Google Repository
  • Android SDK Build-tools 25.0.2 or a later stable official release

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


Advanced Setup Steps

Complete the following steps to set up NativeScript on your Linux development machine:

  1. Install the latest Node.js 6.x or 7.x stable official release. We recommend using Node.js v6.x.

  2. If you are running on a 64-bit system, install the runtime libraries for the ia32/i386 architecture.

    sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 libstdc++6:i386

    If you encounter an error showing "Unable to locate package lib32bz2-1.0" then use

    sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0:i386 libstdc++6:i386
  3. Install the G++ compiler.

    sudo apt-get install g++
  4. Install JDK 8.

    1. Run the following commands.

      sudo apt-get install python-software-properties
      sudo add-apt-repository ppa:webupd8team/java
      sudo apt-get update
      sudo apt-get install oracle-java8-installer
    2. After installation if you have multiple installations of java you can choose which to use:

      sudo update-alternatives --config java
    3. Set the JAVA_HOME system environment variable.

      export JAVA_HOME=$(update-alternatives --query javac | sed -n -e 's/Best: *\(.*\)\/bin\/javac/\1/p')
  5. Install the Android SDK.

    1. Go to Android Studio and SDK Downloads and in the SDK Tools Only section download the package for Linux at the bottom of the page.
    2. After the download completes, unpack the downloaded archive.
    3. Set the ANDROID_HOME system environment variable.
      export ANDROID_HOME=Path to Android installation directory
      For example: ANDROID_HOME=/android/sdk
      NOTE: This is the directory that contains the tools and platform-tools directories.
  6. Install all packages for the Android SDK Platform 25, Android SDK Build-Tools 25.0.2 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.

    sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "platform-tools" "platforms;android-25" "build-tools;25.0.2" "extras;android;m2repository" "extras;google;m2repository"
  7. Setup Android Emulators (AVD) by following the article here

    1. After creating an emulated device you need to:
      • Enable its Developer mode - go to Settings -> About emulated device and tap 7 times on Build number
      • Enable USB debugging - go to Settings -> Developer options and enable USB Debugging
  8. Install the NativeScript CLI.

    1. Run the following command.
    sudo npm install nativescript -g --unsafe-perm
    1. Restart the command prompt.
  9. To check if your system is configured properly, run the following command.

    tns doctor

What’s Next

Is this article helpful? Yes / No
Thank you for your feedback!

Tell us how we can improve this article

NativeScript is licensed under the Apache 2.0 license .
© Progress Software Corporation. All Rights Reserved.