Trellis setup for M1 Apple Silicon macOS

Hi everyone. After discovering Roots this week, I have been trying to get Trellis + Bedrock + Sage to work in my machine (MBP 16" M1 Pro, running macOS Monterey), but haven’t been able to get past Trellis.

The aim of this topic is primarily to document and troubleshoot the most basic Trellis local setup.
And additionally, to add more details that could be useful to other users down the line.

As I was writing this topic, the local development env. started working after running “trellis up”.
Problem is, after a while, it stopped working, and I haven’t been able to get it up again using these commands: vagrant up, vagrant provision, vagrant reload.
So here are my first two questions:

  1. Does it matter to have a correct Vagrant version installed before running the trellis new ... command?
  2. Does Ansible need to be installed on macOS? I could not make it work without it before. (By the way, after having a mess with Ansible when installing/uninstalling in both Homebrew and Python3, the last one I installed was via Homebrew).
  3. How can it stop providing the wordpress to trellis1.test in this case, when apparently not showing any error? Am I missing something? This also happened in my Hackintosh (Intel + VirtualBox). Is this because of NFS? Would that mean there’s no way to develop with Trellis on the latest macOS’s?

This is the setup I followed in my machine to make it work:

  1. Installed python3 with Homebrew
  2. Installed trellis-cli with Homebrew
  3. Installed Vagrant 2.2.17 downloading the Amd64 macOS package from the official website
  4. Installed the “vagrant-parallels” plugin: vagrant plugin install vagrant-parallels
  5. Ran command in my Projects’ directory: trellis new trellis1.com
  6. Replaced vagrant_box and vagrant_box_version as per this documentation
  7. Ran command trellis up in trellis1.com/trellis directory

And the site is working now, although I needed to do this to be able to log in.
The credentials admin:admin don’t work in trellis1.test/wp/wp-login.php.

Other notes:

  • Kind of tried to use VMWare Fusion Tech Preview, and Multipass, but did not make it past they not being Vagrant providers (not that it really matters, as users seem to have issues with anything but Parallels here).
  • Tried using Local by Flywheel with Bedrock and Sage, but got issues with the Acorn dependency needing a php version higher than 8.0, which is not possible in Local by Flywheel, and other dependency issues that I can’t recall anymore.

Being a newbie in anything but front-end, I can’t really tell if this is a good idea; I haven’t tried Lando/Docker yet, and I’ve never used Wordpress outside Shared Hosting providers and Local/Docker this week (without Bedrock nor Sage), but wanted to have a good developer experience that Wordpress just doesn’t provide out of the box.

All the dependencies’ issues explained above, also happened to me yesterday when I was trying to make Trellis work in my Hackintosh (Intel). It ended up working using VirtualBox, Vagrant@2.2.18 and Ansible@5.7.1 installed with python3.

All in all, this experience left me without confidence in this setup. I would really appreciate if someone experienced could share some insights on this, and will try to update this topic so the information in it is more useful and accurate.

Thank you for your time and help.

Hey I am trying to navigate this myself as a front-end dev who has no other help on staff. I am trying to get a local dev up and running on an m1 mac with an existing site running on a slightly older version of Trellis.

Here’s what got me to being able to run a local dev:

On the mac, Ansible 2.9.6 to 2.9.8. Python 3.7. (I believe with newer versions of Trellis, you use a newer version of Ansible, but I do not know which one. Maybe 2.9.10)

As far as Vagrant goes, I’ve only been able to get it to work using 2.2.18. You can find old versions of Vagrant on their website here.. From what I’ve read, it’s best to download the dmg file from that page and install from there. Apparently using the Homebrew is not the best way.

I used Parallels Pro (I know it sucks to pay $99), but they have software that can run on the new processor AND there’s a plugin you can install to get vagrant and trellis working. See below.

In your vagrant.default.yml in your Trellis subdirectory, swap out the settings for these:

vagrant_box: 'jeffnoxon/ubuntu-20.04-arm64'
vagrant_box_version: '>= 1.0.0'

Or if you are like me who has consultants not working on an m1 and you want to keep these settings local to your machine, you can make a vagrant.local.yml file that will override the default but will not be committed.

See here for more info

OK, so from Trellis, you should be able to run Vagrant Up. It will try to provision as well but fail. Once it fails, run vagrant ssh.

Assuming you’ve installed Ubunto 20.04, vagrant will make an ubuntu vm on your local machine. You now need to install certain apps to get the local dev up and running.

I have installed python 3.8 and php 7.4.
You also might need to install Pip as well and then use pip to install Jinja2.

Exit out and try to provision again, and see what happens.

2 Likes

I don’t yet have an M1 Mac, but with any Trellis-related dependent software issue (like Ansible or Vagrant) always make sure you’re running trellis init in your project’s root directory to set up your virtual environment!

1 Like

Thank you @rguttersohn and @MWDelaney for the replies. I didn’t try running anything inside the “ssh”, nor did I run trellis init.

So far, it just worked intermittently until it stopped working, so that seemed to be related to NFS in macOS.

But @rguttersohn, if you say it’s working for you, that gives me hope. I will try that, thank you both :smiley:

Question: Does Ansible only need to run outside the VM? I think the answer is yes, but I wanted to confirm.
I am still running into issues deploying to remote from my m1, but I wanted to confirm that you don’t need a version of Ansible inside the VM that handles local provisioning and then another version outside the vm that handles remote deployments/provisioning.

Good luck!

I’ll also add that I am not using Trellis CLI because it requires a version of Ansible that does not work with my version of Trellis.

This thread might help too:

Hey, I haven’t had much time to thoroughly test it, but, without making any change beyond my OP, the dev env has been working without issues after a “vagrant up”.

Guess I messed something up, as these days I was creating multiple projects with the CLI. It feels great being able to work with these tools, so I’ll be back later this week and see if that’s still the case, thank you everyone! :smile: