OUI MAC Address Lookup CLI
The `oui` package provides a command-line interface (CLI) tool for looking up vendor information associated with MAC addresses within the IEEE Organizationally Unique Identifier (OUI) database. As of version 13.1.7, this package is exclusively a CLI utility, meaning it does not expose any JavaScript or TypeScript APIs for programmatic usage. For developers requiring programmatic access to the OUI data or a library interface, the `oui-data` package is the designated alternative. The project maintains an active development status, with major versions often introducing breaking changes such as Node.js version requirements, removal of features like `search` and `update`, and changes in data sources. Its primary differentiator is its simplicity as a direct command-line lookup tool, relying on the official IEEE data source since version 12.0.0.
Common errors
-
TypeError: oui is not a function
cause Attempting to import or require the `oui` package as a JavaScript module after v13.0.0.fixThe `oui` package is CLI-only. Run it from your shell or use `child_process.exec('oui ...')`. For programmatic data access, install and use the `oui-data` package. -
Error: `oui` requires Node.js 18 or higher. You are using vX.Y.Z.
cause Running the `oui` CLI on a Node.js version older than 18.fixUpgrade your Node.js environment to version 18 or newer. Use `nvm install 18` and `nvm use 18` if you use nvm. -
Error: unknown command 'search'
cause Attempting to use the `oui search` command, which was removed in v13.0.0.fixThe `search` feature is no longer available in the `oui` CLI. Provide the full MAC address for direct lookup, e.g., `oui 20:37:06:12:34:56`. -
Error: no MAC address provided or invalid input
cause Invoking `oui` without a MAC address, or attempting to pipe input via stdin, which is no longer supported.fixProvide the MAC address directly as a command-line argument: `oui 20:37:06:12:34:56`. Stdin input was removed in v11.0.0.
Warnings
- breaking Since v13.0.0, the `oui` package is strictly CLI-only. Any attempt to `import` or `require` it as a JavaScript module will fail.
- breaking Node.js version 18 or higher is now required to run the `oui` CLI.
- breaking The `search` and `update` commands/features were removed in v13.0.0.
- breaking The web version of `oui` was removed in v12.0.0.
- gotcha The data source for OUI lookups switched to the official IEEE source in v12.0.0. This may lead to slight differences in vendor information compared to older versions if a custom or unofficial source was previously used.
- breaking Stdin support on the CLI was removed in v11.0.0, meaning MAC addresses must be passed as command-line arguments.
Install
-
npm install oui -
yarn add oui -
pnpm add oui
Imports
- oui
import { oui } from 'oui'; import oui from 'oui'; const oui = require('oui');This package is CLI-only. Do not import `oui` into JavaScript/TypeScript code.
- search
import { search } from 'oui';This feature has been removed. Use the CLI directly for lookup.
- update
import { update } from 'oui';This feature has been removed.
Quickstart
// This package is CLI-only. For direct programmatic access to OUI data,
// consider using the 'oui-data' package (npm install oui-data).
// Example: Using the 'oui' CLI tool via Node.js child_process
const { exec } = require('child_process');
const macAddressToLookup = '20:37:06:12:34:56';
console.log(`Looking up vendor for MAC: ${macAddressToLookup}...\n`);
exec(`oui ${macAddressToLookup}`, (error, stdout, stderr) => {
if (error) {
console.error(`Error executing oui CLI: ${error.message}`);
return;
}
if (stderr) {
console.error(`CLI stderr: ${stderr}`);
}
console.log(`Vendor Information:\n${stdout.trim()}`);
// Example of how you would use 'oui-data' if installed:
/*
import { lookupMacAddress } from 'oui-data';
(async () => {
try {
const vendorInfo = await lookupMacAddress('20:37:06:12:34:56');
console.log('\n(Programmatic lookup via oui-data):', vendorInfo);
} catch (e) {
console.error('Error looking up via oui-data:', e);
}
})();
*/
});