Registering Nushell Core Plugins\n\nVersion: 1.0.0\nUpdated: 2025-10-22\nNushell: 0.108.0+\n\n## Overview\n\nNushell core plugins are built-in plugins that come with Nushell when you build it with the --workspace flag. They provide essential functionality like data analysis, format conversion, Git integration, and more.\n\nCore plugins include:\n\n- nu_plugin_polars - Data analysis with Polars\n- nu_plugin_formats - Format conversion\n- nu_plugin_inc - Increment operations\n- nu_plugin_gstat - Git status information\n- nu_plugin_query - Advanced querying\n- nu_plugin_custom_values - Custom value handling\n- nu_plugin_example - Example plugin template\n- nu_plugin_stress_internals - Stress testing\n\n---\n\n## How Plugin Registration Works\n\nWhen you register a plugin, you're telling Nushell where to find the plugin binary and to load it automatically. This happens by:\n\n1. Registering: nu -c "plugin add /path/to/nu_plugin_*"\n - Adds plugin path to Nushell config\n - Plugin loads on next Nushell startup\n\n2. Listing: nu -c "plugin list"\n - Shows all registered plugins\n - Verifies registration worked\n\n3. Removing: nu -c "plugin rm plugin_name"\n - Removes plugin from config\n - Plugin unloads after restart\n\n---\n\n## Method 1: Manual Registration\n\n### Register a Single Core Plugin\n\nbash\n# After building nushell with --workspace\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_polars"\n\n\nReplace the path with your actual Nushell target directory.\n\n### Register Multiple Core Plugins\n\nbash\n# Register all built plugins\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_polars"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_formats"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_inc"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_gstat"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_query"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_custom_values"\n\n\n### Verify Registration\n\nbash\nnu -c "plugin list"\n\n\nExpected output shows all registered plugins with their versions.\n\n---\n\n## Method 2: Script-Based Registration\n\n### Using the Installation Script\n\nIf plugins are in ~/.local/bin/:\n\nbash\n./install_from_manifest.nu --all --register-only\n\n\nThis registers all plugins from the manifest.\n\n### Using a Custom Nushell Script\n\nCreate a file register_core_plugins.nu:\n\nnushell\n#!/usr/bin/env nu\n\n# Register Nushell core plugins\ndef register_core_plugins [plugin_dir: string] {\n let core_plugins = [\n "nu_plugin_polars"\n "nu_plugin_formats"\n "nu_plugin_inc"\n "nu_plugin_gstat"\n "nu_plugin_query"\n "nu_plugin_custom_values"\n ]\n\n for plugin in $core_plugins {\n let plugin_path = $"($plugin_dir)/($plugin)"\n\n if ($plugin_path | path exists) {\n try {\n # Remove old registration if exists\n nu -c $"plugin rm ($plugin | str replace '^nu_plugin_' '')" out+err>| null\n } catch {}\n\n # Register new\n nu -c $"plugin add ($plugin_path)"\n print $"✓ Registered: ($plugin)"\n } else {\n print $"✗ Not found: ($plugin_path)"\n }\n }\n}\n\n# Main\nlet plugin_dir = if ($env | get -i NUSHELL_PLUGIN_DIR) != null {\n $env.NUSHELL_PLUGIN_DIR\n} else {\n "/path/to/nushell/target/release"\n}\n\nregister_core_plugins $plugin_dir\n\n\nRun it:\n\nbash\nchmod +x register_core_plugins.nu\n./register_core_plugins.nu\n\n\n---\n\n## Method 3: After Building Nushell\n\n### Step-by-Step After cargo build --workspace\n\n1. Build Nushell with workspace (includes core plugins):\n\nbash\ncd nushell\ncargo build --release --workspace\n\n\n2. Find where core plugins were built:\n\nbash\nls nushell/target/release/nu_plugin_*\n\n\n3. Copy to installation directory (optional, for easy access):\n\nbash\ncp nushell/target/release/nu_plugin_* ~/.local/bin/\n\n\n4. Register plugins:\n\nbash\n# Option A: Register from build directory\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_polars"\nnu -c "plugin add /path/to/nushell/target/release/nu_plugin_formats"\n# ... repeat for all core plugins\n\n# Option B: Register from ~/.local/bin/\nnu -c "plugin add ~/.local/bin/nu_plugin_polars"\nnu -c "plugin add ~/.local/bin/nu_plugin_formats"\n# ... repeat for all core plugins\n\n\n5. Verify:\n\nbash\nnu -c "plugin list"\n\n\n---\n\n## Method 4: Bulk Registration Script\n\n### Create register_all_core_plugins.sh\n\nbash\n#!/bin/bash\n\n# Nushell core plugins registration script\n# Usage: ./register_all_core_plugins.sh /path/to/nushell/target/release\n\nPLUGIN_DIR="${1:-.}"\n\nif [ ! -d "$PLUGIN_DIR" ]; then\n echo "Error: Plugin directory not found: $PLUGIN_DIR"\n exit 1\nfi\n\nPLUGINS=(\n "nu_plugin_polars"\n "nu_plugin_formats"\n "nu_plugin_inc"\n "nu_plugin_gstat"\n "nu_plugin_query"\n "nu_plugin_custom_values"\n)\n\necho "Registering Nushell core plugins from: $PLUGIN_DIR"\necho ""\n\nfor plugin in "${PLUGINS[@]}"; do\n plugin_path="$PLUGIN_DIR/$plugin"\n\n if [ -f "$plugin_path" ]; then\n echo "Registering: $plugin"\n\n # Remove old registration\n nu -c "plugin rm ${plugin#nu_plugin_}" 2>/dev/null || true\n\n # Register new\n nu -c "plugin add $plugin_path"\n\n if [ $? -eq 0 ]; then\n echo "✓ Success: $plugin"\n else\n echo "✗ Failed: $plugin"\n fi\n else\n echo "✗ Not found: $plugin_path"\n fi\ndone\n\necho ""\necho "Registration complete!"\necho ""\necho "Verify with: nu -c \"plugin list\""\n\n\nRun it:\n\nbash\nchmod +x register_all_core_plugins.sh\n./register_all_core_plugins.sh /path/to/nushell/target/release\n\n\n---\n\n## Finding Core Plugins\n\n### After Building with --workspace\n\nCore plugins are built in the same directory as the nu binary:\n\nbash\n# Find where they're built\nfind nushell/target/release -name "nu_plugin_*" -type f\n\n# List them\nls -lh nushell/target/release/nu_plugin_*\n\n\n### Checking Installed Plugins\n\nbash\n# See what's currently registered\nnu -c "plugin list"\n\n# Get detailed info\nnu -c "plugin list | each { |it| {name: $it.name, version: $it.version, path: $it.path} }"\n\n\n---\n\n## Troubleshooting\n\n### Problem: "Plugin not found"\n\nCause: Plugin binary doesn't exist at specified path\n\nSolution:\n\n1. Verify you built with --workspace: cargo build --release --workspace\n2. Check plugin exists: ls nushell/target/release/nu_plugin_*\n3. Use correct full path: nu -c "plugin add /full/path/to/nu_plugin_name"\n\n### Problem: "Plugin already registered"\n\nSolution: Remove old registration first:\n\nbash\nnu -c "plugin rm polars" # Remove by short name\n\n\nThen register new path:\n\nbash\nnu -c "plugin add /path/to/nu_plugin_polars"\n\n\n### Problem: Plugin not loading after registration\n\nSolution:\n\n1. Restart Nushell: exit && nu\n2. Check registration: nu -c "plugin list"\n3. Verify plugin path exists: ls -l /path/to/plugin\n4. Check permissions: chmod +x /path/to/nu_plugin_*\n\n### Problem: Multiple versions of same plugin\n\nSolution: Remove old versions before registering new:\n\nbash\n# Remove\nnu -c "plugin rm polars"\n\n# Verify removed\nnu -c "plugin list"\n\n# Register new path\nnu -c "plugin add /new/path/to/nu_plugin_polars"\n\n\n---\n\n## Common Registration Scenarios\n\n### Scenario 1: Fresh Nushell Build\n\nbash\n# 1. Build with workspace\ncd ~/nushell\ncargo build --release --workspace\n\n# 2. Register all core plugins\nfor plugin in ~/nushell/target/release/nu_plugin_*; do\n nu -c "plugin add $plugin"\ndone\n\n# 3. Verify\nnu -c "plugin list"\n\n\n### Scenario 2: Multiple Nushell Versions\n\nbash\n# Register from specific version\nnu -c "plugin add /opt/nushell-0.108.0/nu_plugin_polars"\n\n\nEach Nushell version can have different plugins.\n\n### Scenario 3: Distribution Installation\n\nbash\n# If plugins are in distribution\n./install_from_manifest.nu --all --register-only\n\n# Or manually\nnu -c "plugin add ./bin/nu_plugin_polars"\nnu -c "plugin add ./bin/nu_plugin_formats"\n\n\n### Scenario 4: Development Workflow\n\nbash\n# After each build during development\ncargo build --release --workspace -p nu_plugin_polars\n\n# Re-register\nnu -c "plugin rm polars"\nnu -c "plugin add ./target/release/nu_plugin_polars"\n\n# Test in new shell\nexit && nu\n\n\n---\n\n## Plugin Configuration\n\n### Where Registration Happens\n\nPlugins are registered in:\n\nplaintext\n~/.config/nushell/env.nu\n\n\nEach registration adds a line like:\n\nnushell\nplugin add /path/to/nu_plugin_polars\n\n\n### Manual Configuration\n\nIf needed, you can manually edit env.nu:\n\nbash\n$EDITOR ~/.config/nushell/env.nu\n\n# Add:\nplugin add /path/to/nu_plugin_polars\nplugin add /path/to/nu_plugin_formats\n\n\nThen restart Nushell.\n\n---\n\n## Best Practices\n\n✅DO:\n\n- Use absolute paths: /full/path/to/nu_plugin_name\n- Remove old registration before re-registering\n- Verify plugins exist before registering\n- Check permissions: chmod +x /path/to/plugin\n- Test after registration: exit && nu\n- Use consistent plugin directory (e.g., ~/.local/bin/)\n\n❌DON'T:\n\n- Use relative paths (they may not work after shell restart)\n- Register plugins that don't exist\n- Register without absolute paths\n- Forget to restart shell after registration\n- Keep multiple copies of same plugin in different locations\n\n---\n\n## Quick Reference\n\n| Task | Command |\n|------|---------|\n| Register single | nu -c "plugin add /path/to/nu_plugin_name" |\n| Register all | Use loop or script (see above) |\n| List all | nu -c "plugin list" |\n| Remove | nu -c "plugin rm plugin_name" |\n| Verify | nu -c "plugin list" or restart shell |\n| Check path | nu -c "plugin list \| get path" |\n\n---\n\n## Related Documentation\n\n- Nushell Official: https://www.nushell.sh/book/plugins.html\n- Distribution System: See DISTRIBUTION_SYSTEM.md\n- Installation: See INSTALLATION_QUICK_START.md\n- Full Workflow: See DISTRIBUTION_INSTALLER_WORKFLOW.md\n\n---\n\n## Summary\n\nTo register Nushell core plugins:\n\n1. Build with workspace: cargo build --release --workspace\n2. Register each plugin: nu -c "plugin add /path/to/nu_plugin_name"\n3. Verify: nu -c "plugin list"\n4. Restart: exit && nu\n\nThat's it! Core plugins work exactly like external plugins - just plugin add with the full path to the binary.