Skip to content

marcosnils/bin

Repository files navigation

bin - Effortless Binary Manager

GitHub release Go Report Card License

A lightweight, cross-platform binary manager that simplifies downloading, installing, and managing binaries without requiring root privileges.

bin

πŸš€ Why bin?

Modern development tools are increasingly distributed as single binary releases thanks to languages like Go, Rust, and Deno. While this makes distribution easier, it creates challenges for updates and tracking.

bin solves these problems by:

  • Zero Configuration: Works out of the box without complex setup, scoring & filtering found the right package
  • No Root Required: Install binaries to user directories without sudo
  • Version Management: Track, update, and rollback binary versions
  • Lightweight: Minimal overhead compared to manually download and install releases
  • Multiple Sources:

For a comprehensive list, see the Tools Wiki.

πŸ“¦ Installation

Quick Install

  1. Download bin from the releases
  2. Run ./bin install github.com/marcosnils/bin so bin is managed by bin itself
  3. Run bin ls to make sure bin has been installed correctly. You can now remove the first file you downloaded.
  4. Enjoy!

πŸ“š Commands Reference

Command Description Example
bin install <repo> [path] Install binary from GitHub or Docker bin install github.com/cli/cli
bin list List installed binaries and versions bin list
bin update [binary...] Update binaries (all or specified) bin update
bin remove <binary...> Remove one or more binaries bin remove gh kubectl
bin ensure Ensure all configured binaries are present bin ensure
bin pin <binary...> Pin current version (prevent updates) bin pin terraform
bin unpin <binary...> Unpin binaries (allow updates) bin unpin terraform
bin prune Remove missing binaries from database bin prune
bin help Show help for any command bin help install

Tips: if bin is unable to found the right package, try bin install -a to show all possible download options (skip scoring & filtering).

🎯 Supported providers

GitHub Releases

Github provider will use Github API to found releases matching your workstation specs.

At the moment, bin does only consider the latest release from Github according to the following definition:

The latest release is the most recent non-prerelease, non-draft release, sorted by the created_at attribute. The created_at attribute is the date of the commit used for the release, and not the date when the release was drafted or published.

You can however install a specific pre-release by specifying the URL for the pre-release, e.g. bin install https://github.com/bufbuild/buf/releases/tag/v0.40.0.

Configuration

Environment Variable Mandatory Description
GITHUB_AUTH_TOKEN no set a token. The access token used with bin does not need any scopes to avoid rate limit or if you need to download from private repo**
GHES_BASE_URL no github enterprise base URL (often is your GitHub Enterprise hostname).
GHES_UPLOAD_URL no github enterprise upload URL (often is your GitHub Enterprise hostname).
GHES_AUTH_TOKEN no github enterprise auth token similar to GITHUB_AUTH_TOKEN.

Usage

# installs latest Kind release
bin install github.com/kubernetes-sigs/kind

# installs a specific release
bin install github.com/kubernetes-sigs/kind/releases/tag/v0.8.0

# installs latest on a specific path
bin install github.com/kubernetes-sigs/kind ~/bin/kind

# installs latest on a specific path and show all possible download options (skip scoring & filtering)
bin install -a github.com/yt-dlp/yt-dlp ~/bin/kind

or explicit

bin install --provider github github.companyname.com/custom/repo

Gitlab Releases

Gitlab provider will use Gitlab API to found releases matching your workstation specs

Configuration

Environment Variable Mandatory Description
GITLAB_TOKEN yes now gitlab enforce token usage and don't have public api, you could setup a personal access token, a GAT or a PAT

Usage

bin install gitlab.com/gitlab-org/cli

or explicit

bin install --provider gitlab gitlab.companyname.com/custom/repo

Docker Images

Docker is also supported or any Docker client compatible runtime.

Configuration

Any variable supported by Docker, see https://docs.docker.com/reference/cli/docker/

Usage

# install the `light` tag for terraform
bin install docker://hashicorp/terraform:light

# install the latest version of calico/node
bin install docker://quay.io/calico/node

For other runtime (like Podman) or for remote docker engine, simply export DOCKER_HOST envvar:

export DOCKER_HOST="unix:///path/to/unix/socket" 
bin install docker://quay.io/calico/node

Hashicorp Releases

Configuration

None.

Usage

Hashicorp have a dedicated releases page and don't use github/lab releases, bin support it.

bin install --provider hashicorp https://releases.hashicorp.com/terraform/1.12.1

If you need multiple versions, specify a destination

bin install --provider hashicorp https://releases.hashicorp.com/terraform/1.5.7 ~/bin/terraform-1.5.7
bin install --provider hashicorp https://releases.hashicorp.com/terraform/1.12.1 ~/bin/terraform-1.12.1

Go Install

Configuration

Ensure go is present in your PATH.

Usage

bin will run go install, and copy the file from GOPATH to your dest.

bin install goinstall://github.com/jrhouston/tfk8s@v0.1.8

πŸ”§ Configuration

Configuration file

bin maintains a configuration file to track installed binaries.

Linux/MacOS

Path to the configuration directory respects the XDG Base Directory specification using the following strategy:

  • Honor BIN_CONFIG is set
  • To prevent breaking of existing configurations, check if $HOME/.bin/config.json exists and return $HOME/.bin
  • If XDG_CONFIG_HOME is set, return $XDG_CONFIG_HOME/bin
  • If $HOME/.config exists, return $home/.config/bin
  • Default to $HOME/.bin/

Windows

Same than linux but uses %USERPROFILE% without XDG_CONFIG_HOME.

Binary Storage

By default, bin stores binaries in:

  • Linux/macOS: ~/.local/bin/
  • Windows: %LOCALAPPDATA%\bin\

Ensure this directory is in your $PATH.

🀝 Contributing

There are some bugs and the code is not tested by lake of time but contributions are welcome though and I'll be happy to discuss and review them.

  • Report bugs or request features via GitHub Issues
  • Submit pull requests for improvements
  • Update documentation

Development Setup

# Clone the repository
git clone https://github.com/marcosnils/bin.git
cd bin

# Clean and init
make clean download

# Run syntax check
make lint verify

# Run tests
make test

# Build from source
make build

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“‹ Rationale

bin started as an idea given the popularity of single binary releases due to the surge of languages like Go, Rust, Deno, etc which can easily produce dynamically and statically compiled binaries.

I found myself downloading binaries (or tarballs) directly from VCS (Github mostly) and then it was hard to keep control and update such dependencies whenever a new version was released. So, with the objective to solve that problem and also looking for something that will allow me to get the latest releases, I created bin.

In addition to that, I was also looking for something that doesn't require sudo or root privileges to install these binaries as downloading, making them executable and storing it somewhere in your PATH would be sufficient.

After I finished the first MVP, a friend pointed out that brew was now supported in linux which almost made me abandon the project. After checking out brew (never been an osx user), I found it a bit bloated and seems to be doing way more than what I'm actually needing. So, I've decided to continue bin and hopefully add more features that could result useful to someone else.

About

Effortless binary manager

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published