Professional utility for Chrome profile selection and management on macOS, designed for Puppeteer, MCP servers, and browser automation workflows
npm install lhi_chrome_profile_utils
A professional utility for Chrome profile selection and management on macOS, designed for use with Puppeteer, MCP servers, and browser automation workflows.


- 🔍 Profile Detection: Automatically detects and lists all Chrome profiles on macOS
- 🎯 Profile Selection: Interactive UI dialog for selecting Chrome profiles
- 🚀 Direct Chrome Launch: Launch Chrome directly with selected profile (recommended)
- 💾 Profile Data Export: Save profile information to JSON for later use
- 🔧 CLI Interface: Command-line tools for profile management
``bash`
npm install lhi_chrome_profile_utils
For the best user experience with full profile features (avatar, theme, bookmarks), use direct Chrome launching:
`javascript
const { spawn } = require('child_process');
const chromeProfileUtils = require('lhi_chrome_profile_utils');
// Select a profile via UI dialog
const { chromeUserDataPath, selectedProfilePath, userDataDir } = chromeProfileUtils.getSelectedProfile();
// Launch Chrome directly
const chromeArgs = [
--profile-directory=${selectedProfilePath},--user-data-dir=${userDataDir}
,
'--disable-blink-features=AutomationControlled',
'https://mail.google.com'
];
const chromeProcess = spawn('/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', chromeArgs, {
detached: true,
stdio: 'ignore'
});
chromeProcess.unref();
`
For automation testing (note: may not show full profile features):
`javascript
const puppeteer = require('puppeteer');
const chromeProfileUtils = require('lhi_chrome_profile_utils');
// Get Puppeteer launch options with the selected profile
const puppeteerOptions = chromeProfileUtils.getPuppeteerLaunchOptions();
const browser = await puppeteer.launch(puppeteerOptions);
`
`javascript
const chromeProfileUtils = require('lhi_chrome_profile_utils');
// List all Chrome profiles
const { chromeUserDataPath, profiles } = chromeProfileUtils.listProfiles();
console.log(Found ${profiles.length} profiles);
// Select a profile via UI dialog
const selectedProfilePath = chromeProfileUtils.selectProfile(profiles);
// Save profile data to JSON
chromeProfileUtils.saveProfilesJSON({ chromeUserDataPath, profiles }, './profiles.json');
`
The package can be used directly from the command line:
`bashList all available Chrome profiles
npx lhi_chrome_profile_utils list
Important Notes
$3
When using direct Chrome launching (recommended approach):
- If this is your first time using a profile with this script, Chrome may require a one-time login
- After this initial login, subsequent launches will automatically use your saved profile
- This is normal Chrome security behavior when launching from a new context
$3
- Direct Chrome Launch (recommended): Full profile features, normal Chrome behavior
- Puppeteer Launch: Automation mode, may show warnings, limited profile features
$3
If Chrome opens in a semi-incognito mode or doesn't show your profile:
1. Use the direct Chrome launch approach instead of Puppeteer
2. Ensure you've logged in at least once using the direct launch method
3. Check that Chrome is the ARM-native version on Apple Silicon Macs
API Reference
$3
Lists all Chrome user profiles with detailed information.
Returns:
Object with:
- chromeUserDataPath: Path to Chrome user data directory
- profiles: Array of profile objects with details (email, name, theme color, etc.)$3
Displays a macOS dialog for profile selection.
Parameters:
-
profiles: Array of profile objects from listProfiles()Returns:
String - The path of the selected profile$3
Combines listing and selection in one step.
Returns:
Object with:
- chromeUserDataPath: Path to Chrome user data directory
- selectedProfilePath: Path of the selected profile
- userDataDir: Full path to the selected profile directory$3
Gets Puppeteer launch options for the selected Chrome profile.
Parameters:
-
headless: Boolean indicating whether to run in headless mode (default: false)Returns:
Object - Puppeteer launch options with user data directory$3
Saves profile data to a JSON file.
Parameters:
-
profileData: Profile data object from listProfiles()
- outputPath: Path where to save the JSON fileReturns:
Boolean` - Success status- macOS operating system
- Google Chrome installed
- Node.js 14.0.0 or higher
MIT © Lifehack Innovations LLC
---
