DEV Community

Cover image for Installing Alacritty without installing Rust
Migsar Navarro
Migsar Navarro

Posted on

Installing Alacritty without installing Rust

A week ago I came to the Alacritty's project homepage, again, and I wanted to install it, again, but was discouraged by reading that I had to build it.

I used to build things back in the days (I won't say I was really into compiling things from source, but I am old enough to have lived in a world before i , but more and more I prefer the convenience of just installing things without having to install all the dev tools in my machine.

In Rust's Docker image description you can find a section entitled Compile your app inside the Docker container, which is precisely what I wanted to do, but there will be a problem since two lxcb libraries are not included:

  = note: /usr/bin/ld: cannot find -lxcb-shape
          /usr/bin/ld: cannot find -lxcb-xfixes
          collect2: error: ld returned 1 exit status

error: could not compile `alacritty` due to previous error
Enter fullscreen mode Exit fullscreen mode

I had already started with this, so I'll depart a bit for some config, but it is essentially the same.

  1. Instead of using the image to run cargo directly open a shell console.
docker run --rm -it -v (pwd):/backup rust /bin/bash
Enter fullscreen mode Exit fullscreen mode
  1. Update sources and install lxcb dev libraries.
# You are already root inside the container
apt-get update

# This is the only lib missing from Alacritty's build pre-requisites
apt-get install libxcb-xfixes0-dev

# Now compile, you can use the more concise command from Rust's image description
cargo install alacritty
# I mounted my home dir as /backup
cp /usr/local/cargo/bin/alacritty /backup/alacritty
Enter fullscreen mode Exit fullscreen mode
  1. Outside of the container you need to copy alacritty to some directory included in your PATH, I used:
sudo mv alacritty /usr/local/bin/alacritty
Enter fullscreen mode Exit fullscreen mode

One final notice is that, as stated in the build instructions, this won't install the terminfo file, desktop entry, manual page or shell completions, but shouldn't be hard to get that working.

Top comments (2)

Collapse
 
deciduously profile image
Ben Lovy

Great write-up, but I also want to point out that alacritty is pre-packaged for many Linux distros. On Fedora, I could just run sudo dnf install alacritty. Definitely useful information here either way, and I agree that their homepage does not make this clear at all, but you can likely skip the whole Docker thing unless you have a specific need to run the build manually.

Collapse
 
migsarnavarro profile image
Migsar Navarro

Yeah, that's a good point. I did try to install it that way in Ubuntu without success, but it is something worth checking. I saw it was briefly mentioned in the readme, but in the home page links directly to build instructions.