{"id":25646,"library":"google-closure-compiler-osx","title":"google-closure-compiler-osx","description":"The OS X native binary distribution of Google's Closure Compiler, a JavaScript optimization and type-checking tool. This package provides the compiler via a Java binary specifically for macOS. Current stable version: 20240317.0.0. Releases follow upstream Closure Compiler releases, typically monthly. This is the platform-specific variant for macOS; equivalent packages exist for linux, windows, and a Java-based generic one. Key differentiator: optimized native binary for macOS vs running via Java.","status":"active","version":"20240317.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/google/closure-compiler-npm#master","tags":["javascript","compiler","optimizer","minifier","closure","java"],"install":[{"cmd":"npm install google-closure-compiler-osx","lang":"bash","label":"npm"},{"cmd":"yarn add google-closure-compiler-osx","lang":"bash","label":"yarn"},{"cmd":"pnpm add google-closure-compiler-osx","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The Java-based fallback if native binary fails","package":"google-closure-compiler-java","optional":true}],"imports":[{"note":"ESM only; no default export.","wrong":"const getNativeImagePath = require('google-closure-compiler-osx').getNativeImagePath","symbol":"getNativeImagePath","correct":"import { getNativeImagePath } from 'google-closure-compiler-osx'"},{"note":"CommonJS fallback; ESM preferred but platform is the default export in CJS.","wrong":"import platform from 'google-closure-compiler-osx'","symbol":"platform","correct":"const platform = require('google-closure-compiler-osx')"},{"note":"Exposed as a string path to the native binary.","wrong":"","symbol":"binaryPath","correct":"import { binaryPath } from 'google-closure-compiler-osx'"}],"quickstart":{"code":"const { exec } = require('child_process');\nconst path = require('path');\nconst cc = require('google-closure-compiler-osx');\nconst compilerPath = cc.binaryPath;\n\n// Compile a simple JavaScript file\nconst child = exec(`${compilerPath} --compilation_level SIMPLE_OPTIMIZATIONS --js input.js --js_output_file output.min.js`);\nchild.stdout.on('data', (data) => console.log(data));\nchild.stderr.on('data', (data) => console.error(data));","lang":"javascript","description":"Shows how to use the Google Closure Compiler native binary for macOS to minify a JavaScript file using simple optimizations."},"warnings":[{"fix":"Update to version >=20230501 or use the Java fallback via google-closure-compiler-java.","message":"The native binary may require Rosetta 2 on Apple Silicon Macs for versions before 2023.","severity":"gotcha","affected_versions":"<20230501"},{"fix":"Use google-closure-compiler-linux or google-closure-compiler-windows for other platforms.","message":"The package is platform-specific; installing on non-macOS will fail or fallback to Java.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to >=20201001 or ensure JRE is installed if using older versions.","message":"Switched from bundled Java to native binary in v20201001. Old versions were Java-based requiring JRE.","severity":"breaking","affected_versions":"<20201001"}],"env_vars":null,"search_vec":"'20240317.0.0':40 'base':68 'binari':10,33,75 'check':23 'closur':3,15,44,86 'compil':4,16,29,45,83 'current':37 'differenti':72 'distribut':11 'equival':58 'exist':60 'follow':42 'generic':69 'googl':2,13 'google-closure-compiler-osx':1 'java':32,67,81,87 'java-bas':66 'javascript':18,82 'key':71 'linux':62 'maco':36,57,77 'minifi':85 'month':48 'nativ':9,74 'one':70 'optim':19,73,84 'os':7 'osx':5 'packag':26,59 'platform':53 'platform-specif':52 'provid':27 'releas':41,46 'run':79 'specif':34,54 'stabl':38 'tool':24 'type':22 'type-check':21 'typic':47 'upstream':43 'variant':55 'version':39 'via':30,80 'vs':78 'window':63 'x':8","created_at":"2026-05-01T13:45:50.221715+00:00","updated_at":"2026-05-01T13:45:50.221715+00:00","problems":[{"fix":"Install with npm install google-closure-compiler-osx --save-dev","cause":"Package not installed or not available on this platform","error":"Error: Cannot find module 'google-closure-compiler-osx'"},{"fix":"Check that input file exists and path is absolute or correctly relative.","cause":"Input file path is incorrect or missing","error":"Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.io.FileNotFoundException: /path/to/input.js"},{"fix":"Remove the -Dfile.encoding=UTF-8 flag from your command.","cause":"Encoding flag not supported on native binary","error":"WARNING: -Dfile.encoding=UTF-8 not supported"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"google-closure-compiler","cli_version":null,"type":"library","homepage":"https://developers.google.com/closure/compiler/","github":"https://github.com/google/closure-compiler-npm.git#master","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/google-closure-compiler-osx","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}