github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/docs/2-the-jackal-cli/0-building-your-own-cli.md (about)

     1  # Building Your Own Jackal CLI
     2  
     3  To build the Jackal CLI from scratch, you'll need to have the following dependencies configured:
     4  
     5  1. The Jackal repository cloned down:
     6     - `git clone git@github.com:Racer159/jackal.git`.
     7  2. Have Go 1.19.x installed on your PATH (instructions to [install Go](https://go.dev/doc/install)).
     8  3. Have NPM/Node 18.x installed on your PATH (instructions to [install NPM/Node](https://nodejs.org/en)).
     9  4. `make` utility installed on your PATH.
    10     - Instructions to install on macOS with [Homebrew](https://formulae.brew.sh/formula/make).
    11     - Instructions to install on Windows with [Chocolatey](https://community.chocolatey.org/packages/make), [Scoop](https://scoop.sh/#/apps?q=make&s=0&d=1&o=true&id=c43ff861c0f1713336e5304d85334a29ffb86317), or [MSYS2](https://packages.msys2.org/package/make).
    12  
    13  :::note
    14  
    15  If you are running `make` targets other than the `build-cli-*` targets described below, you may need more software installed.  Inspect the `Makefile` at the root of the project to view the commands each target runs.
    16  
    17  :::
    18  
    19  If you don't want to build the CLI yourself, you can download a pre-compiled binary from the 'Assets' tab of our latest [releases](https://github.com/Racer159/jackal/releases) on GitHub. The pre-compiled binary is available for both arm64 and amd64 machines.
    20  
    21  ## Building the CLI
    22  
    23  Once you have the dependencies configured, you can build the Jackal CLI by running the following commands:
    24  
    25  ```bash
    26  cd jackal        # go into the root level of the jackal repository
    27  
    28  make build-cli # This will build binaries for linux, M1 Mac, and Intel Mac machines
    29                 # This puts the built binaries in the ./build directory
    30  ```
    31  
    32  :::note Optimization Note
    33  The `make build-cli` command builds a binary for each combination of OS and architecture, which may take some time. If you only need a binary for a specific configuration, you can use one of the following commands:
    34  
    35  - `make build-cli-mac-intel`
    36  - `make build-cli-mac-apple`
    37  - `make build-cli-linux-amd`
    38  - `make build-cli-linux-arm`
    39  - `make build-cli-windows-amd`
    40  - `make build-cli-windows-arm`
    41  :::
    42  
    43  #### The Technical Process
    44  
    45  [Under the hood](https://github.com/Racer159/jackal/blob/473cbd5be203bd38254556cf3d55561e5be247dd/Makefile#L44), the `make` command executes a `go build .....` command with specific `CGO_ENABLED`, `GOOS`, and `GOARCH` flags depending on the distro and architecture of the system it is building for. The `CLI_VERSION` is passed in as a `ldflag` and is set the latest tag is in the repository as defined by `git describe --tags`.