Installing Trellis in WSL: The following formula cannot be installed from bottle and must be built from source. trellis-cli

Howdy! I decided to try installing Trellis in WSL on my desktop Windows 11 computer so that I’d be able to leave the work computer at work for once.

However, I can’t get past this error:

user@DESKTOP-43LSUO1:~$ brew install roots/tap/trellis-cli
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Fetching roots/tap/trellis-cli
==> Downloading https://github.com/roots/trellis-cli/releases/download/v1.11.1/trellis_Linux_x86_64.tar.gz
Already downloaded: /home/user/.cache/Homebrew/downloads/d8f2bd599a8afaaf0dea020f026412cf4cea6fc16460f9644541e33daf63fbf3--trellis_Linux_x86_64.tar.gz
==> Installing trellis-cli from roots/tap
Error: The following formula cannot be installed from bottle and must be
built from source.
  trellis-cli
Install Clang or run `brew install gcc`.
user@DESKTOP-43LSUO1:~$ brew install gcc
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Warning: gcc 14.1.0 is already installed and up-to-date.
To reinstall 14.1.0, run:
  brew reinstall gcc

I’ve also tried installing Clang and that doesn’t seem to help.

Same error as above, except in an image if someone prefers it that way:

Any ideas?

So apparently you need to install build-essential to make Trellis-CLI install properly in WSL. Maybe that should be added to the guide?

  • sudo apt-get install build-essential procps curl file git
1 Like

Question to other Windows users: Did you ever get Vagrant working with WSL2? I feel like I’m encountering issue after issue. Getting Trellis working on macOS was a breeze. Is WSL2 just trash? I don’t understand how everything from the file rights to the SSH can give seemingly random issues.

I’m considering a dual boot to avoid the pain of this.

WSL2 works with the following configuration:

Additional requirements for Windows users

  • WSL2
  • Vagrant must be installed in WSL
  • VirtualBox must be installed in Windows
  • The following must be set in your WSL ~/.bashrc or ~/.zshrc file:
    • VAGRANT_WSL_ENABLE_WINDOWS_ACCESS = 1
    • export PATH=“$PATH:/mnt/c/Program Files/Oracle/VirtualBox
1 Like

Thanks! I will try this from scratch and we’ll see if it works or not :grimacing:

Shouldn’t it have an export in front of it?

  • export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS=“1”

Otherwise WSL says this on startup:
VAGRANT_WS_ENABLE_WINDOWS_ACCESS: command not found

It’s also listed with an export in front of it here:

Also, even with those two commands added to the .bashrc, I’m still encountering this issue:

Error: The following formula cannot be installed from bottle and must be
built from source.
trellis-cli
Install Clang or run brew install gcc.

So that should probably be added to the guide as well.

So you are still getting this bottle error?

Is this an Ubuntu system? Have you installed the build-essential package for gcc?

Sorry, I was unclear. I meant that you have to install build-essential and that that isn’t listed anywhere in the documentation :wink:

I’m using Ubuntu 22.04.

Another thing that isn’t listed at all is the solution to this:

Apparently you need to install virtualbox_WSL2:
vagrant plugin install virtualbox_WSL2

With all that installed, I manage to start a VM:

johan@DESKTOP-43LSUO1:/mnt/d/User/WP/example$ trellis up
Starting galaxy role install process
- composer (1.9.0) is already installed, skipping.
- ntp (2.3.1) is already installed, skipping.
- logrotate (v0.0.5) is already installed, skipping.
- swapfile (v2.0.36) is already installed, skipping.
- mailpit (v1.0.0) is already installed, skipping.

Running command => vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/ubuntu-22.04' version '202404.23.0' is up to date...
==> default: [vagrant-hostmanager:guests] Updating hosts file on active guest virtual machines...
==> default: [vagrant-hostmanager:host] Updating hosts file on your workstation (password may be required)...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Running action triggers after up ...
==> default: Running trigger...
==> default: Adding vagrant ssh-config for www.example.test to ~/.ssh/config

==> default: Machine 'default' has a post `vagrant up` message. This is a message
==> default: from the creator of the Vagrantfile, and not from Vagrant itself:
==> default: 
==> default: Your Trellis Vagrant box is ready to use!
==> default: * Composer and WP-CLI commands need to be run on the virtual machine
==> default:   for any post-provision modifications.
==> default: * You can SSH into the machine with `vagrant ssh`.
==> default: * Then navigate to your WordPress sites at `/srv/www`
==> default:   or to your Trellis files at `/home/vagrant/trellis`.

And when I write vagrant ssh, nothing happens:

johan@DESKTOP-43LSUO1:/mnt/d/User/WP/example/trellis$ vagrant ssh