Nushell (Nu) is a cross-platform shell that treats data as structured values. Instead of parsing every command’s text output, you can pass tables and records through a pipeline and query their fields directly. That makes tasks like inspecting processes, working with APIs, and converting files feel consistent. The Nushell quick tour introduces this structured pipeline model.
Install Nushell on macOS
The official Nushell installation guide lists Homebrew as a convenient option for macOS. If Homebrew is installed, install Nu with:
Check the installed version and start an interactive Nushell session:
This installs Nushell alongside your existing shell. Run exit to leave Nu; you can also launch it any time by typing nu in Terminal.
Create and query tables
Nushell’s native commands often return structured data. A list of records becomes a table, and commands such as where, sort-by, and select filter, order, and choose its columns.
Create a small table, keep active users, sort them by name, and display selected columns:
let users = [
{name: "Alice", role: "Engineer", active: true}
{name: "Grace", role: "Designer", active: true}
{name: "Oliver", role: "Engineer", active: false}
]
$users | where active | sort-by name | select name role The value in $users is still structured data. You can keep adding commands to the pipeline instead of converting it to text and parsing it again.
Find processes using the most CPU or memory
Nushell’s built-in ps command returns process information as a table. Sort by CPU, remove rows where macOS does not provide a value, and show the busiest processes:
For processes using the most resident memory, sort by mem:
On Nushell 0.117 and later, ps --long also includes private, the memory used only by a process—the value Activity Monitor labels “Memory.” Use that column when you want to compare against Activity Monitor:
compact removes rows with null values before sorting. On macOS, some details for processes owned by other users or protected by the system may be unavailable to a regular user. The process command reference and 0.117 release notes describe these fields and platform differences.
Call REST APIs
The http commands make requests and, by default, parse JSON responses into Nu records or tables. For example, fetch a post from JSONPlaceholder and select a few fields:
You can also read one field directly:
Send a JSON body with http post. JSONPlaceholder is a test API, so this example is for learning rather than storing a real post:
For an API that requires a bearer token, keep the token in an environment variable instead of writing it into a script or sharing it in a command:
See the official HTTP cookbook for request bodies, headers, response metadata, and more examples. A JSON response is already parsed by http get; use --raw when you specifically need the response as text.
Convert CSV and JSON
open recognizes common file formats by their extension. Convert a CSV table to JSON, or a JSON array of records to CSV:
CSV stores values as text and has no native representation for nested records. If a numeric column should become a JSON number, convert it before writing the JSON file:
When the destination already exists, save --force overwrites it. Review the table shape before converting nested JSON to CSV; choose the fields to keep with select first. The data formats guide covers CSV, JSON, and their format-specific behavior.
Convert between naming cases
The str subcommands convert strings into common naming conventions. These examples all start with customer id:
| Nushell command | Result |
|---|---|
str camel-case | customerId |
str pascal-case | CustomerId |
str snake-case | customer_id |
Try each command on a string:
To compare several inputs at once, pass a list through each and build one output record per name:
["first name" "firstName" "first_name"] | each {|name| {
source: $name,
camel: ($name | str camel-case),
pascal: ($name | str pascal-case),
snake: ($name | str snake-case)
}} Nu also provides str kebab-case and str title-case. The string guide explains how these commands split words and handle punctuation.
Keep learning from the prompt
Nu’s built-in help describes commands and their flags. Look up a command as you work:
Once a command returns a table, try select to choose columns, where to filter rows, and sort-by to order them. That pattern is a practical starting point for exploring files, processes, API responses, and other structured data.