Node For Mac Os X

Node.js lets developers use JavaScript to develop wide variety of applications like network applications, command line tools, web api, web applicationsIn this document, we will cover installation procedure of nodejs on mac operating systemPrerequisitesThis guide assumes that you are using mac os. Visual Studio 2019 for Mac. Develop apps and games for iOS, Android and using.NET. Download Visual Studio for Mac. Create and deploy scalable, performant apps using.NET and C# on the Mac. NodeXL by Anu is an Excel add-in created for performing various network overview, discovery, analysis, inventory, and exploration tasks. Unfortunately NodeXL can be used on Mac only through virtual machines or in the cloud. Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Latest LTS Version: 12.19.0 (includes npm 6.14.8) Download the Node.js source code or a pre-built installer for your platform, and start developing today.

OpenThread released by Google is an open-source implementation of the Thread networking protocol. Google Nest has released OpenThread to make the technology used in Nest products broadly available to developers to accelerate the development of products for the connected home.

The Thread specification defines an IPv6-based reliable, secure and low-power wireless device-to-device communication protocol for home applications. OpenThread implements all Thread networking layers including IPv6, 6LoWPAN, IEEE 802.15.4 with MAC security, Mesh Link Establishment, and Mesh Routing.

This Codelab will walk you through simulating a Thread network on simulated devices.

What you'll learn

  • How to set up the OpenThread build toolchain
  • How to simulate a Thread network
  • How to authenticate Thread nodes
  • How to manage a Thread network with OpenThread Daemon

What you'll need

  • git
  • Basic knowledge of Linux, network routing

Git

Git is required to complete this Codelab. Download and install it before continuing.

Once installed, follow the instructions for your specific OS to download and build OpenThread.

XCode for Mac OS X

XCode is required to install and build OpenThread on Mac OS X.

After XCode is installed, install the XCode Command Line Tools:

Build on Linux / Mac OS X

These installation instructions have been tested on Ubuntu Server 14.04 LTS and Mac OS X Sierra 10.12.6.

Install OpenThread. The bootstrap commands make sure the toolchain is installed and the environment is properly configured:

Using Windows

If you prefer Windows, we recommend trying the Docker version of this Codelab.

Once your installation is complete, build the example OpenThread application. For this Codelab we are using the simulation example.

Now build OpenThread Daemon:

The example application you'll use for this Codelab demonstrates a minimal OpenThread application that exposes the OpenThread configuration and management interfaces via a basic command-line interface (CLI).

This exercise takes you through the minimal steps required to ping one simulated Thread device from another simulated Thread device.

Note: This first exercise does not include any network parameter configuration, such as the IEEE 802.15.4 PAN ID or the Thread Master Key. OpenThread currently implements default values for network parameters (which can be changed later via the CLI).

The figure below describes a basic Thread network topology. For this exercise, we'll simulate the two nodes within the green circle: a Thread Leader and Thread Router with a single connection between them.

Ping a node

1**. Start Node 1**

Navigate to the openthread directory and spawn the CLI process for a simulated Thread device using the ot-cli-ftd binary.

10.8

x86_64-unknown-linux-gnu represents the platform of VM used for this Codelab. When using a different OS image, OpenThread processes will be found under a different path. For example, on Mac OS X, the platform would be x86_64-apple-darwin. Check the ~/src/openthread/output folder for the correct platform value to use.

This binary implements an OpenThread device simulated on top of POSIX. The IEEE 802.15.4 radio driver is implemented on top of UDP (IEEE 802.15.4 frames are passed within UDP payloads).

The argument of 1 is a file descriptor that represents the least-significant bits of the 'factory-assigned' IEEE EUI-64 for the simulated device. This value is also used when binding to a UDP port for IEEE 802.15.4 radio emulation (port = 9000 + file descriptor). Each instance of a simulated Thread device in this Codelab will use a different file descriptor.

Note: Only use file descriptors of 1 or greater as noted in this Codelab when spawning the process for a simulated device. A file descriptor of 0 is reserved for other use.

If you don't see the >prompt after running this command, press enter**.**

Create a new Operational Dataset and commit it as the active one. The Operational Dataset is the configuration for the Thread network you are creating.

dataset init new creates a new Operational Dataset with random values. Your values will differ from the values shown in this Codelab. Replace the values in the Codelab example commands with the values from your Operational Dataset.

Commit this dataset as the active one:

Bring up the IPv6 interface:

Start Thread protocol operation:

Wait a few seconds and verify that the device has become the Thread Leader. The Leader is the device responsible for managing router ID assignment.

View the IPv6 addresses assigned to Node 1's Thread interface (your output will be different):

Note the specific IPv6 address types:

  • Begins with fd = mesh-local
  • Begins with fe80 = link-local

Mesh-local address types are classified further:

  • Contains ff:fe00 = Router Locator (RLOC)
  • Does not contain ff:fe00 = Endpoint Identifier (EID)

Identify the EID in your console output make a note of it for later use. In the sample output above, the EID is:

fd61:2344:9a52:ede0:d041:c5ba:a7bc:5ce6

The RLOC will change as the network topology changes and a Thread device switches between states. The EID is independent of topology changes and will remain static.

2. Start Node 2

Open a new terminal and navigate to the openthread directory and spawn the CLI process. This is your second simulated Thread device:

If you don't see the >prompt after running this command, press enter**.**

Configure the Thread Master Key and PAN ID, using the same values as Node 1's Operational Dataset:

Commit this dataset as the active one:

Bring up the IPv6 interface:

Start Thread protocol operation:

The device will initialize itself as a Child. A Thread Child is equivalent to an End Device, which is a Thread device that transmits and receives unicast traffic only with a Parent device.

Within 2 minutes you should see the state switch from child to router. A Thread Router is capable of routing traffic between Thread devices. It is also referred to as a Parent.

Verify the network

An easy way to verify the mesh network is to look at the router table.

1. Check connectivity

On Node 2, get the RLOC16. The RLOC16 is the last 16 bits of the device's RLOC IPv6 address.

On Node 1, check the router table for Node 2's RLOC16. Make sure Node 2 has switched to the router state first.

Node 1's RLOC of 0xa800 is found in the table, confirming that it is connected to the mesh.

2. Ping Node 1 from Node 2

Verify connectivity between the two simulated Thread devices. In Node 2, ping the EID assigned to Node 1:

Press enter to return to the > CLI prompt.

Test the network

Now that you can successfully ping between two simulated Thread devices, test the mesh network by taking one node offline.

Return to Node 1 and stop Thread:

Switch to Node 2 and check the state. Within two minutes, Node 2 detects that the leader (Node 1) is offline, and you should see Node 2 transition to be the leader of the network:

Once confirmed, stop Thread and factory reset Node 2 before exiting. A factory reset is done to ensure that the Thread network credentials we used in this exercise are not carried over to the next exercise.

Also factory reset and exit Node 1:

See the OpenThread CLI Reference to explore all available CLI commands.

In the previous exercise, you set up a Thread network with two simulated devices and verified connectivity. However, this only allows unauthenticated IPv6 link-local traffic to pass between devices. To route global IPv6 traffic between them (and the Internet via a Thread border router), nodes must be authenticated.

In order to authenticate, one device must act as a Commissioner. The Commissioner is the currently elected authentication server for new Thread devices, and the authorizer for providing the network credentials required for the devices to join the network.

In this exercise, we will use the same two-node topology as before. For authentication, the Thread Leader will act as the Commissioner, the Thread Router as a Joiner.

Devices without Thread interfaces may also perform the Commissioner role. For example, a cell phone or a server in the cloud can provide the interface by which a human administrator joins a new device to the Thread Network. These devices are called External Commissioners.

1. Create a network

If continuing from the previous exercise, you should already have two terminal windows open. If not, make sure two are open and ready to use. One will serve as Node 1, the other as Node 2.

In Node 1, spawn the CLI process:

x86_64-unknown-linux-gnu represents the platform of the VM used for this Codelab. When using a different OS image, OpenThread processes will be found under a different path. For example, on Mac OS X, the platform would be x86_64-apple-darwin.

If you don't see the > prompt after running this command, hit enter.

Create a new Operational Dataset, commit it as the active one, and start Thread:

Commit this dataset as the active one:

Bring up the IPv6 interface:

Start Thread protocol operation:

Wait a few seconds and verify that the device has become a Thread Leader:

2. Start the Commissioner role

While still on Node 1, start the Commissioner role:

Allow any Joiner (by using the * wildcard) with the J01NME Joiner Credential to commission onto the network. A Joiner is a device that is added by a human administrator to a commissioned Thread Network.

J01NME is the user-defined Joiner Credential used for this Codelab. You can choose any Joiner Credential you wish in a different implementation of a Thread network. For more information, see Thread Commissioning.

3. Start the Joiner role

In a second terminal window, spawn a new CLI process. This is Node 2.

On Node 2, enable the Joiner role using the J01NME Joiner Credential.

Node For Mac Os X

... wait a few seconds for confirmation ...

As a Joiner, the device (Node 2) has successfully authenticated itself with the Commissioner (Node 1) and received the Thread Network credentials.

If you get a Join failed message, the Commissioner may have timed out waiting for a Join request. In that case, restart from the commissioner joiner command. Don't wait too long after starting the Commissioner to enable the Joiner role.

You may also receive error and/or log messages on both Nodes 1 and 2 after a successful join. These are normal and can be ignored.

Now that Node 2 is authenticated, start Thread:

4. Validate network authentication

Check the state on Node 2, to validate that it has now joined the network. Within two minutes, Node 2 transitions from child to router:

5. Reset configuration

Node For Mac Os X

To prepare for the next exercise, reset the configuration. On each Node, stop Thread, do a factory reset, and exit the simulated Thread device:

You may have to press enter a few times to bring the > prompt back after a factoryreset command.

For this exercise, we are going to simulate one CLI instance (a single embedded SoC Thread device) and one Radio Co-Processor (RCP) instance.

ot-daemon is a mode of the OpenThread Posix app that uses a UNIX socket as input and output, so that OpenThread core can run as a service. A client can communicate with this service by connecting to the socket using the OpenThread CLI as the protocol.

ot-ctl is a CLI provided by ot-daemon to manage and configure the RCP. Using this, we'll connect the RCP to the network created by the Thread device.

Use ot-daemon

This exercise will use three terminal windows, corresponding to the following:

  1. CLI instance of simulated Thread device (Node 1)
  2. ot-daemon process
  3. ot-ctl CLI instance

If continuing from the previous exercise you should already have two terminal windows open. Open a third to ensure you have three terminal windows available for this exercise.

1. Start Node 1

In the first terminal window, spawn the CLI process for your simulated Thread device:

x86_64-unknown-linux-gnu represents the platform of VM used for this Codelab. When using a different OS image, OpenThread processes will be found under a different path. For example, on Mac OS X, the platform would be x86_64-apple-darwin.

If you don't see the > prompt after running this command, hit enter.

Create a new Operational Dataset, commit it as the active one, and start Thread:

Commit this dataset as the active one:

Bring up the IPv6 interface:

Start Thread protocol operation:

The channel is the 2.4 GHz channel as defined in IEEE 802.15.4. Non-reserved values are in the range of 11-26.

The masterkey can be any user-defined 32 hexadecimal character string. If not specified, the masterkey defaults to 00112233445566778899AABBCCDDEEFF, and devices will be able to join the network without having to specify the key.

View the IPv6 addresses assigned to Node 1's Thread interface:

As explained in the Simulate a Thread network step, one address is link-local (fe80) and three are mesh-local (fd). The EID is the mesh-local address that does not contain ff:fe00 in the address. In this sample output, the EID is fd55:cf34:dea5:7994:460:872c:e807:c4ab.

Identify the specific EID from your ipaddr output, which will be used to communicate with the node.

2. Start ot-daemon

In the second terminal window, navigate to the openthread directory, and start ot-daemon for an RCP node, which we'll call Node 2. Use the -v verbose flag so you can see log output and confirm that it is running:

x86_64-unknown-linux-gnu represents the platform of VM used for this Codelab. When using a different OS image, OpenThread processes will be found under a different path. For example, on Mac OS X, the platform would be x86_64-apple-darwin.

When successful, ot-daemon in verbose mode generates output similar to the following:

3. Use ot-ctl to join the network

We haven't commissioned Node 2 (the ot-daemon RCP) to any Thread network yet. This is where ot-ctl comes in. ot-ctl uses the same CLI as the OpenThread CLI app. Therefore, you can control ot-daemon nodes in the same manner as the other simulated Thread devices.

In a third terminal window, start ot-ctl:

Check the state of Node 2 (the RCP node) you started with ot-daemon:

Get Node 2's eui64, to restrict joining to the specific Joiner:

On Node 1, start the Commissioner and restrict joining to only that eui64:

On Node 2, bring up the network interface and join the network:

... wait a few seconds for confirmation ...

As a Joiner, the RCP (Node 2) has successfully authenticated itself with the Commissioner (Node 1) and received the Thread Network credentials.

If you get a Join failed message, the Commissioner may have timed out waiting for a Join request. In that case, restart from the commissioner joiner command. Don't wait too long after starting the Commissioner to enable the Joiner role.

Node For Mac Os X 10.13

Now join Node 2 to the Thread network:

4. Validate network authentication

Check the state on Node 2, to validate that it has now joined the network. Within two minutes, Node 2 transitions from child to router:

5. Validate connectivity

Quit ot-ctl by using Ctrl+D and on your host machine's command line, ping Node 1, using its EID with the ping6 command. If the ot-daemon RCP instance is successfully joined to and communicating with the Thread network, the ping succeeds:

Warning: If you quit ot-ctl by using the exit command, ot-daemon will terminate as well, as the CLI processor used by ot-ctl is running within ot-daemon. To ensure ot-daemon and any related nodes continue to run, use Ctrl+D to quit ot-ctl.

You've successfully simulated your first Thread network using OpenThread. Awesome!

In this Codelab you learned how to:

  • Set up the OpenThread build toolchain
  • Simulate a Thread network
  • Authenticate Thread nodes
  • Manage a Thread network with OpenThread Daemon

If you want to learn more, explore these references:

Node.js is actually an essential tool for every developer. Basically are a javascript interpreter for a command line. This is very interesting because allows executing javascript in any environment; you can make server-side applications, command line tools, webs, etc. An actually have a lot of followers, apps, frameworks to work with it. This ecosystem is incredible an make easier life when you work with.

But Node isn’t alone. Come with other powerful tool called npm. Npm is a package manager that allow installing third party libraries in javascript. For development, this is amazing because you could have an entire development environment in minutes.

Let’s do install Node.

Install Node

you have two ways to install in Mac OS X.

Use Installer

The easiest way to install node is with the package manager.

  1. Go to https://nodejs.org/en/download/
  2. Download Mac installer version
  3. Execute and follow step by step

Use Homebrew

How To Install Node JS On Mac OS? - PositronX.io

Homebrew is defined as package manager that OS X should have. First, we need to install homebrew. Open a terminal window and write:

2
Homebrew1.2.3
Homebrew/homebrew-core(git revision501b;last commit2017-06-27)

Node For Mac Os X 10.7

Now we can install Node:

And after some more text, you will be Node.JS installed.

Test It

If you open a terminal and write:

You will have the version output:

2
5.3.0

Why use Homebrew instead Installer

Update Node Mac Os X

Why is better to use homebrew instead installer? Easy, you need administrative privileges to install, this means use sudo to install with package installer and are a big problem for working with it. You will need use sudo in front of node and this one doesn’t like execution with root privileges. To avoid this problem use Hombrew to install it.