Skip to content

Commit 4b0d918

Browse files
committed
docs: Split Mac install instructions
Okay, so I think this is what happened to me: 1) I had brew installed on my Intel Mac 2) I got an Apple Silicon Mac 3) I setup my new Mac by copying over Intel Mac harddrive 4) I now have two brew's installed on my machine: a) /usr/local/bin/brew (for intel macs & cross-compiling) b) /opt/homebrew/bin/brew (for (for apple silicon) 5) The wrong brew was in my path (a) Looking through our getting started docs, we seem to reference both /usr/local/... and opt/homebrew/... Update the installation document to mac this and related issues more clear for new users who might run into this problem. Changelog-None
1 parent 4f9e13c commit 4b0d918

File tree

1 file changed

+114
-12
lines changed

1 file changed

+114
-12
lines changed

doc/getting-started/getting-started/installation.md

Lines changed: 114 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -324,30 +324,49 @@ poetry install
324324
make
325325
```
326326

327-
## To Build on macOS
327+
## To Build on macOS Apple Silicon
328328

329-
Assuming you have Xcode and Homebrew installed. Install dependencies:
329+
Assuming you have Xcode and Homebrew installed.
330330

331+
First confirm which architecture of Mac you are running
331332
```shell
332-
brew install autoconf automake libtool python3 gnu-sed gettext libsodium protobuf lowdown
333-
export PATH="/usr/local/opt:$PATH"
333+
arch
334334
```
335+
If you see this result: `arm64`
336+
Continue with these instructions. If you see any other result switch to Build on macOS Intel instructions.
335337

336-
If you need SQLite (or get a SQLite mismatch build error):
337-
338+
Confirm you are using Apple Silicon Homebrew
338339
```shell
339-
brew install sqlite
340-
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
341-
export CPPFLAGS="-I/usr/local/opt/sqlite/include"
340+
which brew
341+
which pkg-config
342+
```
343+
If you see this result:
342344
```
345+
/opt/homebrew/bin/brew
346+
/opt/homebrew/bin/pkg-config
347+
```
348+
You are using Apple Silicon Homebrew and can continue with the instructions, skip to "Install dependencies"
349+
350+
If you see this in the result: `/usr/local/bin/brew`
351+
You are using brew in Intel compatibility mode. The simplest solution is to remove brew entirely, reinstall it, and start these instructions over.
343352

344-
Some library paths are different when using `homebrew` on Macs with Apple silicon, therefore the following two variables need to be set for Macs with Apple silicon:
353+
Install dependencies:
345354

346355
```shell
356+
brew install autoconf automake libtool python3 gnu-sed gettext libsodium protobuf lowdown pkgconf
357+
export PATH="/opt/homebrew/opt/:$PATH"
347358
export CPATH=/opt/homebrew/include
348359
export LIBRARY_PATH=/opt/homebrew/lib
349360
```
350361

362+
If you need SQLite (or get a SQLite mismatch build error):
363+
364+
```shell
365+
brew install sqlite
366+
export LDFLAGS="-L/opt/homebrew/opt/sqlite/lib"
367+
export CPPFLAGS="-I/opt/homebrew/opt/sqlite/include"
368+
```
369+
351370
Install uv for Python dependency management:
352371

353372
```shell
@@ -385,6 +404,11 @@ Build lightning:
385404
```shell
386405
uv sync --all-extras --all-groups --frozen
387406
./configure
407+
```
408+
409+
If you see `/usr/local` in the log, an Intel compatability dependency has been picked up. The simplest solution is to remove brew entirely, reinstall it, and start these instructions over.
410+
411+
```shell
388412
uv run make
389413
```
390414

@@ -406,10 +430,88 @@ To install the built binaries into your system, you'll need to run `make install
406430
make install
407431
```
408432

409-
On a Mac with Apple silicon, you may need to use this command instead:
433+
You may need to use this command instead. Confirm the exported PATH, CPATH, and LIBRARY_PATH environment varaibles set earlier are still present.
434+
```shell
435+
sudo make install
436+
```
437+
438+
## To Build on macOS Intel
439+
440+
Assuming you have Xcode and Homebrew installed.
441+
442+
Install dependencies:
443+
444+
```shell
445+
brew install autoconf automake libtool python3 gnu-sed gettext libsodium protobuf lowdown pkgconf
446+
export PATH="/usr/local/opt/:$PATH"
447+
export CPATH=/usr/local/include
448+
export LIBRARY_PATH=/usr/local/lib
449+
```
450+
451+
If you need SQLite (or get a SQLite mismatch build error):
452+
453+
```shell
454+
brew install sqlite
455+
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
456+
export CPPFLAGS="-I/usr/local/opt/sqlite/include"
457+
```
458+
459+
Install uv for Python dependency management:
460+
461+
```shell
462+
curl -LsSf https://astral.sh/uv/install.sh | sh
463+
```
464+
465+
After installing uv, restart your shell or run `source ~/.zshrc` to ensure `uv` is in your PATH.
466+
467+
If you don't have bitcoind installed locally you'll need to install that as well:
468+
469+
```shell
470+
brew install boost cmake pkg-config libevent
471+
git clone https://github.com/bitcoin/bitcoin
472+
cd bitcoin
473+
cmake -B build
474+
cmake --build build --target bitcoind bitcoin-cli
475+
cmake --install build --component bitcoind && cmake --install build --component bitcoin-cli
476+
```
477+
478+
Clone lightning:
479+
480+
```shell
481+
git clone https://github.com/ElementsProject/lightning.git
482+
cd lightning
483+
```
484+
485+
Checkout a release tag:
486+
487+
```shell
488+
git checkout v24.05
489+
```
490+
491+
Build lightning:
410492

411493
```shell
412-
sudo PATH="/usr/local/opt:$PATH" LIBRARY_PATH=/opt/homebrew/lib CPATH=/opt/homebrew/include make install
494+
uv sync --all-extras --all-groups --frozen
495+
./configure
496+
uv run make
497+
```
498+
499+
Running lightning:
500+
501+
> 📘
502+
>
503+
> Edit your `~/Library/Application\ Support/Bitcoin/bitcoin.conf`to include `rpcuser=<foo>` and `rpcpassword=<bar>` first, you may also need to include `testnet=1`.
504+
505+
```shell
506+
bitcoind &
507+
./lightningd/lightningd &
508+
./cli/lightning-cli help
509+
```
510+
511+
To install the built binaries into your system, you'll need to run `make install`:
512+
513+
```shell
514+
make install
413515
```
414516

415517
## To Build on Arch Linux

0 commit comments

Comments
 (0)