Skip to content

Commit bd27760

Browse files
devJCMais
authored andcommitted
docs: add Homebrew installation instructions for macOS
1 parent 383427f commit bd27760

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,60 @@ The `/usr/include` is now available on `$(xcrun --show-sdk-path)/usr/include`. T
418418
npm_config_curl_include_dirs="$(xcrun --show-sdk-path)/usr/include" yarn add node-libcurl
419419
```
420420

421+
#### Homebrew
422+
423+
In the case you got
424+
```
425+
error: use of undeclared identifier 'curl_ws_start_frame'; did you mean 'curl_ws_frame'?
426+
```
427+
428+
It means your system is using the macOS SDK's libcurl headers, which are outdated (version below 8.16, which requireds for WebSocket support).
429+
430+
You must use `curl` install via Homebrew, you can use the following steps to make sure the system picks up the Homebrew `curl` headers/libs when building from source.
431+
432+
1. Install `curl` with Homebrew (if you don't already have it):
433+
434+
```bash
435+
brew install curl
436+
```
437+
438+
2. Add Homebrew's `curl` to your environment so build tools can find headers, libraries and `curl-config`:
439+
440+
```zsh
441+
export PATH="$(brew --prefix curl)/bin:$PATH" # optional
442+
443+
export CPPFLAGS="-I$(brew --prefix curl)/include"
444+
export LDFLAGS="-L$(brew --prefix curl)/lib"
445+
export PKG_CONFIG_PATH="$(brew --prefix curl)/lib/pkgconfig"
446+
```
447+
448+
Note: On Intel macs Homebrew is typically installed under `/usr/local` and on Apple Silicon under `/opt/homebrew`. Using `$(brew --prefix curl)` is the most portable option across both architectures.
449+
450+
3. Build & install `node-libcurl` from source.
451+
452+
Optional: remove a previously installed local copy of `node-libcurl` first to ensure a clean build:
453+
454+
```zsh
455+
# remove previously installed copy (local environment only)
456+
rm -rf node_modules/node-libcurl
457+
```
458+
459+
Then build from source. Depending on your macOS Xcode/CLT version you may need to also point to the SDK's `/usr/include` directory:
460+
461+
If you prefer to explicitly use the Homebrew-installed `curl` headers instead of the SDK include path, you can use:
462+
463+
```zsh
464+
npm_config_curl_include_dirs="$(brew --prefix curl)/include" npm_config_curl_libraries="-L$(brew --prefix curl)/lib -lcurl" npm install node-libcurl --build-from-source
465+
```
466+
467+
Or if you want to use the SDK's include path:
468+
```zsh
469+
# build & install
470+
npm_config_curl_include_dirs="$(xcrun --show-sdk-path)/usr/include" npm install node-libcurl --build-from-source
471+
```
472+
473+
This should allow your machine to build the addon using the Homebrew `curl` installation.
474+
421475
### Building on Windows
422476

423477
If installing using a prebuilt binary you only need to have the [visual c++ 2017 runtime library](https://visualstudio.microsoft.com/downloads/#microsoft-visual-c-redistributable-for-visual-studio-2017).

0 commit comments

Comments
 (0)