📜 ⬆️ ⬇️

Install NativeScript on Mac OS

Hello, dear Habravchane. I hasten to share with you my little experience in a seemingly simple matter - to install NativeScript on Mac OS.

Recently, we received an application for the study of NativeScript to identify the positive and negative aspects of this technology.

To be honest, I encountered a number of troubles during the installation of NativeScript on my Mac. Unfortunately, in my amateur opinion, the official material does not contain a full-fledged installation guide, and third-party resources are already confusing, suggesting one or the other methods, again silent about the pitfalls, which further leads to confusion in dependencies , reinstall various packages, etc.
')
In this article, I will not talk about the pros and cons, but we'll talk about the banal installation. In order not to suffer anyone else.

The article is an exact sequence of actions relevant at the moment (04/24/17)

I assume that you already have Xcode. If not, go to the Apple site or install from the store. So let's get started ...

  1. Open terminal

  2. Enter the following command to install the brew package manager:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

    After installation, you can check the version of the package by entering the command:

     brew -v 

  3. Enter the NodeJS installation command (without specifying sudo):

     brew install node 

    You can check the version of NodeJs and NPM with the commands:

     node -v 

    and

     npm -v 

    A small remark: please do not put the NodeJS from the package from the official site! Brew is used in this article. Otherwise, you risk becoming entangled in dependencies and something will not “wind up”.

  4. Install the Command Line Tools for Xcode, link .

  5. Install xcodeproj:

     sudo gem install xcodeproj 

  6. Install CocoaPods

     sudo gem install cocoapods 

  7. Install the JDK - download the * .dmg package from the Oracle site. And install.

  8. Install Android by downloading from the Android site.

  9. After installing Android Studio, go into the AndroidStudio shell settings and install additional Android versions 22, 23, 24 and 25 from the section:
    Appearence & Behavior / System Settings / Android SDK

    as shown in the picture below.

    image

  10. Then enter:

     echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.profile 

    and

     echo "export ANDROID_HOME=$HOME/Library/Android/sdk" >> ~/.profile 

    This way, the .profile file will be created or added if it already exists.

  11. Enter the console again:

     export JAVA_HOME=$(/usr/libexec/java_home) 

    and

     export ANDROID_HOME=$HOME/Library/Android/sdk 

    This will apply environment variables without restarting bash .

  12. Check the variables:

     echo $ANDROID_HOME 

     echo $JAVA_HOME 

  13. Be sure to execute the command:

     sudo xcode-select -r 

  14. We have come to a culmination, namely, to the installation of NativeScript itself. Enter the command (without specifying sudo):

     npm install nativescript -g 

That's all! Looking at this seemingly absolutely unnecessary material, I would like to say that it was the absence of such material that made me spend a lot of time and nerves.

I wish you pleasant coding and success in this direction.

Additional material:

  1. Setup your Mac to develop NativeScript Apps
  2. Quick setup
  3. NativeScript Advanced Setup: macOS

Source: https://habr.com/ru/post/327508/


All Articles