Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 114 additions & 12 deletions doc/getting-started/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,30 +324,49 @@ poetry install
make
```

## To Build on macOS
## To Build on macOS Apple Silicon

Assuming you have Xcode and Homebrew installed. Install dependencies:
Assuming you have Xcode and Homebrew installed.

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

If you need SQLite (or get a SQLite mismatch build error):

Confirm you are using Apple Silicon Homebrew
```shell
brew install sqlite
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include"
which brew
which pkg-config
```
If you see this result:
```
/opt/homebrew/bin/brew
/opt/homebrew/bin/pkg-config
```
You are using Apple Silicon Homebrew and can continue with the instructions, skip to "Install dependencies"

If you see this in the result: `/usr/local/bin/brew`
You are using brew in Intel compatibility mode. The simplest solution is to remove brew entirely, reinstall it, and start these instructions over.

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:
Install dependencies:

```shell
brew install autoconf automake libtool python3 gnu-sed gettext libsodium protobuf lowdown pkgconf
export PATH="/opt/homebrew/opt/:$PATH"
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
```

If you need SQLite (or get a SQLite mismatch build error):

```shell
brew install sqlite
export LDFLAGS="-L/opt/homebrew/opt/sqlite/lib"
export CPPFLAGS="-I/opt/homebrew/opt/sqlite/include"
Comment on lines +366 to +367
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have a version of this in our makefile for Apple Darwin already, so it may just work already? But builds work on my machine...so I'm scared to also take this out of the instruction set for macOS incase this somehow breaks the build for other people lol 👀

Perhaps we should be bold and take it out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Makefile feels like a better place to put this for sure 🤔

```

Install uv for Python dependency management:

```shell
Expand Down Expand Up @@ -385,6 +404,11 @@ Build lightning:
```shell
uv sync --all-extras --all-groups --frozen
./configure
```

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.

```shell
uv run make
```

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

On a Mac with Apple silicon, you may need to use this command instead:
You may need to use this command instead. Confirm the exported PATH, CPATH, and LIBRARY_PATH environment varaibles set earlier are still present.
```shell
sudo make install
```

## To Build on macOS Intel

Assuming you have Xcode and Homebrew installed.

Install dependencies:

```shell
brew install autoconf automake libtool python3 gnu-sed gettext libsodium protobuf lowdown pkgconf
export PATH="/usr/local/opt/:$PATH"
export CPATH=/usr/local/include
export LIBRARY_PATH=/usr/local/lib
```

If you need SQLite (or get a SQLite mismatch build error):

```shell
brew install sqlite
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include"
```
Comment on lines +452 to +457
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, they will also need the openssl library. These lines can go away once #8647 gets merged in.


Install uv for Python dependency management:

```shell
curl -LsSf https://astral.sh/uv/install.sh | sh
```

After installing uv, restart your shell or run `source ~/.zshrc` to ensure `uv` is in your PATH.

If you don't have bitcoind installed locally you'll need to install that as well:

```shell
brew install boost cmake pkg-config libevent
git clone https://github.com/bitcoin/bitcoin
cd bitcoin
cmake -B build
cmake --build build --target bitcoind bitcoin-cli
cmake --install build --component bitcoind && cmake --install build --component bitcoin-cli
```

Clone lightning:

```shell
git clone https://github.com/ElementsProject/lightning.git
cd lightning
```

Checkout a release tag:

```shell
git checkout v24.05
```

Build lightning:

```shell
sudo PATH="/usr/local/opt:$PATH" LIBRARY_PATH=/opt/homebrew/lib CPATH=/opt/homebrew/include make install
uv sync --all-extras --all-groups --frozen
./configure
uv run make
```

Running lightning:

> 📘
>
> Edit your `~/Library/Application\ Support/Bitcoin/bitcoin.conf`to include `rpcuser=<foo>` and `rpcpassword=<bar>` first, you may also need to include `testnet=1`.

```shell
bitcoind &
./lightningd/lightningd &
./cli/lightning-cli help
```

To install the built binaries into your system, you'll need to run `make install`:

```shell
make install
```

## To Build on Arch Linux
Expand Down
Loading