# Troubleshooting Setting up Bitcoin and Lightning Node on Apple Silicon (arm64) MacBooks

As I began my journey with the world of Bitcoin, the first challenge at hand was knowing how to get the work environment set up. The first problem is getting the info I need all in one place especially since am running an arm64 architecture. I found bits and pieces of how to go about it and decided to help the readers simplify their setting-up journey by sharing issues I faced and from other peers and how I solved them.

### Prerequisites and Environment Setup

This tutorial assumes you have `brew` and `git` installed. Here a few points to note in setting up your environment.

Before anything, we should follow guidelines, and tutorials properly, here is a resource that does justice to installing bitcoin on MacOS [Install Bitcoin on MacOS](https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md).

Run the following command to clone the repo:

1. **Install Bitcoin with zmq**
    
    You should compile `bitcoin` with zmq as it helps in debugging connections between bitcoin and lightning. To do this make sure `zeromq` is installed using
    
    ```bash
    brew install zeromq
    ```
    
    And then configure bitcoin using this command
    
    ```bash
    ./configure --with-zmq --enable-zmq
    ```
    
2. **Aliases Update:**
    
    Always make sure to update your aliases and run
    
    ```bash
    source ~/.bash_profile
    ```
    
    To update your current terminal tab.
    

### **Common Issues and Solutions**

1. **Command not found for**`lnd`**or**`lncli`**:**
    
    If the `lnd` installation was completed and `go` is installed, and still `lnd` or `lncli` command not found, run
    
    ```bash
    which go
    ```
    
    should return something like
    
    ```bash
    /opt/homebrew/bin/go
    ```
    
    then confirm the go executable path exist by running
    
    ```bash
    ls ~/go
    ```
    
    should return
    
    ```bash
    bin pkg
    ```
    
    We need to confirm `lnd` and `lncli` is part of the go path
    
    ```bash
    ls ~/go/bin
    ```
    
    should return
    
    ```bash
    lncli lnd
    ```
    
    Now we just copy the executables to default installation location
    
    ```bash
     sudo cp ~/go/bin/lnd /usr/local/bin/
     sudo cp ~/go/bin/lncli /usr/local/bin/
    ```
    
2. **Error Message: \`LND setup: unable to create partial chain control: status code: 401, response: ""**
    
    This usually rises from when your `rpcauth` on your `bitcoin.conf` does not match your `rpcuser` and `rpcpassword` in your lnd.conf
    
    Make sure to use the username and password provided when you run this command
    
    `python3 ./share/rpcauth/`[`rpcauth.py`](http://rpcauth.py)`<your-desired-username> <your-password>`
    
    and place the returned `rpcauth` in the `bitcoin.conf`.
    
3. **Error Message: Unable to connect to &lt;lightingnode-pubkey&gt;@127.0.0.1:9734: EOF**
    
    You could get this if you trying to connect to a wrong `identity-pubkey` of another lightning node.
    
4. **Error: Bitcoind** `testnet`**is consuming so much space when syncing.**
    
    This is due to not having a limit to which the blockchain should sync, this imit it done by setting a value to the prune parameter in the `bitcoin.conf`
    
5. **Error Message:  error message: Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.**
    
    This happens when connecting two nodes and creating a channel.
    
    A walkaround for this would be adding `fallbackfee=0.000001` to the `bitcoin.conf` and restarting `bitcoind` and `lnd`
    
    So that transactions are quickly added to blocks mined in `regtest`
    
6. **Error Message : \[lncli\] could not load global options: unable to read macaroon path (check the network setting!): open /Users/decagon/Library/Application Support/Lnd/data/chain/bitcoin/mainnet/admin.macaroon: no such file or directory**
    
    This simply says that your `lnd` is not talking to your `bitcoind` properly, meaning they are not on the same mode `[regtest, testnet, mainnet]`
    
    Check your `lnd.conf` mode and `bitcoind` with the same mode is running.
    
7. Balance not reflecting on `regtest` or `testnet`
    
    For `regtest` , you may get
    
    ```bash
    {
        "mine": {
            "trusted": 0.00000000,
            "untrusted_pending": 0.00000000,
            "immature": 100.00000000
          },
          "lastprocessedblock": {
            "hash": "5adf04f4ddbfe4d28e2f4877734a4171f726486e726aee3b2fbc0e6f558fe64f",
            "height": 107
          }
    }
    ```
    
    when you run `bitstein-cli getbalances`
    
    You need to generate some blocks say like `100` 😀.
    
    For `testnet` , make sure your node is synced to the current block, don't forget to prune your node to avoid filling your space with older blocks.
    
8. **Error:**`lnd`**console stuck at "Waiting for chain backend to finish sync, start\_height"**
    
    Just generate a block in using `bitcoin-cli generate 1` while
    

### **Conclusion**

By addressing common installation issues outlined in this article, you can enjoy a seamless experience in setting up and maintaining their cryptocurrency nodes. Always refer to the official documentation and community resources for the latest updates and solutions to emerging challenges. In a future article, we’ll walk through creating a command line wallet that using `bitcoinjs-lib`.

If you have any questions, suggestions, or errata to submit, my DMs are open on [Discord](https://discord.com/users/736574772141621332). I hope this helps you on and going as it did for me!
