Using Lightning on MacOS
Lightning is a layer-2 technology built on top of Bitcoin which allows quick and secure payments. Lightning greatly improves Bitcoin’s usability by enabling very small payments to be processed quickly without having to settle on the base layer, which can take greater than 10 minutes in some instances.
This is a quick written + visual tutorial for Mac users on how to setup all the necessary software to use Spark to make payments with
c-lightning. It only takes a few steps with some easily copy/paste-able commands.
Spark: a light but feature-rich Lightning wallet app, built on c-lightning.
c-lightning: one of three major, cross-compatible implementations of the Lightning Network (alongside lnd and eclair), led by Blockstream.
1. Download Bitcoin Core
.tar.gz archives and install
2. Running Bitcoin Core
3. Install Homebrew
4. Install required software with Homebrew
c-lightning and build it
7. Download, run, and configure Spark
8. Open Lightning channels with Spark
9. Paying with Spark
Step 1: Download Bitcoin Core
First, we need to download both the Bitcoin Core
.dmg file and the
.tar.gz file to your Downloads folder. The
.dmg contains the GUI, while the
.tar.gz file contains
bitcoin-cli – a command line application which interacts with the
First, drag the Bitcoin Core app to your Applications folder. Once that is done, you can then install the
To do so, all we have to do is uncompress the
.tar.gz file and copy
bitcoin-cli to a specific folder. Open up the Terminal app and paste these commands:
tar zxvf ~/Downloads/bitcoin-0.17.1-osx64.tar.gz
mkdir ~/Library/Application\ Support/Bitcoin && echo "server=1" >> ~/Library/Application\ Support/Bitcoin/bitcoin.conf
sudo cp ~/Downloads/bitcoin-0.17.1/bin/bitcoin-cli /usr/local/bin
Just input your password and you should be good to go for this step!
Note that at any time you can pause, restart, rewind, and maximize the screen captures.
Step 2: Running Bitcoin Core for the first time and syncing the blockchain
Now that we have Bitcoin Core installed, we can fire it up and start syncing the blockchain! Note that it will take a few hours (depending on your internet connection and computer hardware) to download all of the data we need – roughly 200 GB.
Step 3: Install Homebrew
This is pretty straightforward. Just navigate your web browser to https://brew.sh and copy the command displayed on the site. Paste the command into your terminal, hit enter, and input your password when prompted.
Or copy and paste this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Step 4: Install needed software with Homebrew
Now we need to use Homebrew to install some software so we can compile
The software we need can be installed with this command. Just copy and paste into your terminal.
brew install autoconf automake libtool python3 gmp gnu-sed
Step 5: Download
c-lightning code and build it
Now we use
git to download the
c-lightning source code, then build it!
git clone https://github.com/ElementsProject/lightning.git
sudo make install
Step 6: Run
c-lightning will allow you to generate Bitcoin addresses, connect to other nodes, and open payment channels.
First, start your new Lightning node by copying and pasting this command or typing it in manually:
lightningd --mainnet --daemon --log-level debug
This will start your Lightning node. After starting, you can then use
lightning-cli to control the node:
lightning-cli newaddr p2sh-segwit
This will generate a new Bitcoin address that you can send to in order to fund new Lightning channels.
Once you’ve sent some BTC to an address you generated, you can now open channels and start sending and receiving payments over Lightning!
Step 7: Download, run, and configure Spark
In this step we download the Spark
.zip file from Github, run Spark, and configure it to connect to our
To connect Spark to your node, simply type in your Lightning node’s data directory when Spark is first started.
Input this in the “Path to c-lightning” box:
Click “Connect”, then “Save settings”.
Step 8: Open Lightning channels with Spark
Spark has channel management functionality which you can use to open and close channels without requiring manual input. To access the channel management section, click on the
node: <first 10 characters of your public key> at the bottom of the UI. Then, input the node URI that you would like to open a channel to and how much BTC you would like to use to fund the channel.
The node URI in this case is my node located at:
Step 9: Paying with Spark
When checking out at a merchant’s website, simply copy and paste the
bolt11 invoice (which starts with “ln” and has a lot of random characters) to your Spark wallet.
The demo payment shown in the video went through three separate Lightning nodes to get to the Blockstream Store‘s node. That’s decentralization for you! 😎
Thanks for reading!