If wkhtmltoimage exits with error while loading shared libraries: libicui18n.so.42: cannot open shared object file: No such file or directory, the binary it launched requires the ICU library with that exact versioned name, and the system cannot find it. Identify the executable and your Linux distribution and release first. Then either install the matching ICU runtime from a repository appropriate to that system, or replace the executable with a build compatible with the host. There is no single verified package name or installation command that applies to every Linux distribution.
What the error means
This is a startup-time shared-library lookup failure. It occurs before wkhtmltoimage can do its screenshot work: the executable requests libicui18n.so.42, and the loader cannot locate that library under the requested name. Installing or configuring the Ruby gem that calls the binary may not resolve the underlying mismatch if the executable itself still depends on the missing library.
The exact error was reported for /usr/bin/wkhtmltoimage in a 2015 Stack Overflow question involving the Ruby imagekit gem, the wkhtmltoimage-binary package, and CentOS 6.6. That is one historical setup, not a general prescription for current systems. A commenter suggested installing libicu but was uncertain about the package source. Treat that as a clue to investigate, not a verified install instruction for your machine.
Identify the executable and operating system
Before changing packages, establish which binary is failing and what environment it runs in. A wrapper, gem, container, or scheduled job may use a different executable or environment from the one you test in an interactive shell.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errors#1 Best Overall
-
In the same shell and environment where the failure occurs, run
command -v wkhtmltoimage. This reports the executable found through that shell’s command search path, if one is found. -
Check the operating-system identification with
cat /etc/os-release. Record the distribution and release, as well as the machine architecture. A package available for one release or architecture may not exist for another. -
If a wrapper or application launches the binary, check its configuration or logs to learn the exact path it invokes. If the reported path is
/usr/bin/wkhtmltoimage, inspect that executable rather than assuming the shell-found copy is the one in use. -
Run
ldd /path/to/wkhtmltoimage, replacing the example path with the actual executable path. Look for a line indicating thatlibicui18n.so.42is not found. Iflddcannot inspect the file or the output differs, do not assume this is the only missing dependency; continue with the exact executable and runtime environment used by the application.Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Use diagnostic commands with care: the key result is the requested soname and which binary requests it. The package remedy depends on the host’s repositories and release, not just on the fact that the command is named wkhtmltoimage.
Rank #2
Choose a repair that matches the host
There are two sound directions: provide the runtime dependency expected by the existing executable, or use a compatible executable build. Compare them against your distribution release, architecture, the required ICU soname, the package source, and the availability of the binary’s other runtime dependencies.
| Approach | When it fits | What to verify |
|---|---|---|
| Install the matching ICU runtime | The current executable is needed and a suitable package is available from a repository appropriate to this host. | Package name, release and architecture match; the installed package provides the requested libicui18n.so.42 name; the package source is appropriate for the system. |
| Replace the executable with a compatible build | The host does not provide the runtime expected by the existing binary, or a compatible build is the more maintainable option for your environment. | The build supports this host and architecture, and its remaining runtime dependencies are available. |
Option 1: Install the matching runtime
Check the official documentation or package metadata for your distribution and release to determine whether it supplies the exact required ICU runtime and what the package is called. Package naming and availability are not established uniformly across distributions; the sources documenting this error do not provide verified current installation commands for each one.
If the exact runtime is available from an appropriate repository, install it using that system’s documented package procedure. Then inspect the executable’s dependencies again and retry the original command. A recommendation simply to install a package called libicu is not enough to establish that it supplies the required versioned library on your release.
Option 2: Use a compatible executable
If the host does not offer the required runtime, look for a wkhtmltoimage build intended for the same distribution release and architecture as the machine that runs it. Confirm its documented runtime requirements before substituting it. If an application or gem bundles or selects its own binary, make sure the replacement changes the executable that application actually launches.
After changing the binary, check its dependencies again. Fixing the ICU lookup may uncover a separate missing shared library; a successful fix for this one name does not establish that every dependency is installed.
Rank #3
Do not substitute another ICU version with a guessed symlink
ICU libraries use versioned sonames. Historical Debian bug material shows versioned library names alongside an unversioned linker name, illustrating that names can vary by platform and version. It does not establish that a different ICU version is ABI-compatible with the requested .so.42 library.
Do not create a symlink from another ICU version to libicui18n.so.42 merely to make the loader stop reporting a missing file. That changes the name the loader sees; it does not demonstrate that the binary can safely use the library behind it. Use a matching runtime or a compatible executable instead.
Verify the repair and handle the next failure
-
Run
ldd /path/to/wkhtmltoimageagain using the path to the executable that the application actually invokes. Check whether the ICU entry is now resolved and note any other missing libraries. -
Retry the same
wkhtmltoimagecommand, from the same user and runtime environment that failed. If it starts but reports another missing shared library, diagnose that dependency separately; the original ICU error may have been only the first one encountered. -
If the error is unchanged, confirm that you installed the runtime on the same host or container where the command runs, that the installed package provides the exact requested soname, and that you changed the executable you identified earlier.
Rank #4
-
If the command works in a shell but fails through a Ruby application, compare the executable path and environment used by the application with your manual test. The reported Stack Overflow case involved a Ruby gem, but the report does not establish one universal gem-specific fix.
Free tools Windows power users keep installed
One-click scans. No signup required.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Common causes and fixes
-
A package suggestion does not fit the operating system. The CentOS 6.6 report is historical, and the commenter’s suggested package source was uncertain. Identify your own release and consult its package documentation rather than copying a command intended for another system.
-
The installed ICU library has a different versioned name. The missing name is specifically
libicui18n.so.42. Confirm that the package supplies that name; do not assume a library with a different soname is interchangeable. -
You inspected or repaired the wrong binary. Find the exact path used by the invoking shell, wrapper, or application, then inspect that file’s dependencies and retest through the same route.
-
The ICU error disappears, but the command still fails to start. Inspect the dependency output and address the next missing library using a package or executable compatible with the same host. Resolving one missing dependency is not proof that all dependencies are satisfied.
Recommended: PC Feels Slow? A Free Scan Shows What's Dragging Windows Down →Recommended: Crashes or Glitches? A Free Driver Scan Usually Finds the Culprit →Recommended: Fix Windows Errors and Clear Junk Files in Minutes - Free Scan →Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Or skip the browser setup
If your goal is to capture a website rather than maintain a local wkhtmltoimage runtime, ScreenshotNeo is a website screenshot API and MCP server. A request can return a PNG, JPEG, WebP, or PDF. For example, this cURL request saves a WebP screenshot of Stripe:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for parameters and setup. Before capture, it can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Plans and features are described at the linked product pages. Sign up for ScreenshotNeo’s free plan.
Frequently Asked Questions
Does this error mean wkhtmltoimage itself is missing?
No. This particular message says the loader cannot find the requested ICU shared library while starting the executable. A separate “command not found” error would point to a different problem.
Will installing any ICU package fix it?
Not necessarily. The important check is whether a package appropriate to your release and architecture provides the exact requested soname, libicui18n.so.42. Package names and availability vary.
Recommended Free Tools
Can I fix the problem without changing the host’s ICU packages?
Yes, if you can use a wkhtmltoimage build compatible with the host’s available runtime. Verify its other dependencies as well; a replacement binary can have its own requirements.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

