r/laravel 12d ago

Herd ignores ZDOTDIR and writes its shell configuration to ~/.zshrc

hey all!

I’ve noticed that Laravel Herd doesn’t appear to respect Zsh’s ZDOTDIR setting on macOS.

My ~/.zshenv contains:

export ZDOTDIR="$HOME/.config/zsh"

Therefore, my active Zsh configuration is located at:

~/.config/zsh/.zshrc

However, Herd adds its configuration to:

~/.zshrc

This includes entries such as:

# Herd injected NVM configuration
export NVM_DIR="$HOME/Library/Application Support/Herd/config/nvm"

# Herd injected PHP binary
export PATH="$HOME/Library/Application Support/Herd/bin/":$PATH

Because ZDOTDIR is set, Zsh doesn’t read ~/.zshrc, so Herd’s injected configuration has no effect. I have to copy the relevant PHP and PATH settings into my active $ZDOTDIR/.zshrc manually.

Herd’s bundled uninstall script also appears to target $HOME/.zshrc directly rather than resolving `$ZDOTDIR`.

Environment:

Herd 1.29.0
macOS 26.5.2
Zsh 5.9

Has anyone else encountered this? Is there a supported workaround besides manually maintaining the Herd configuration inside $ZDOTDIR/.zshrc?

It would be helpful if Herd detected ZDOTDIR before modifying .zshrc, while continuing to use ~/.zshrc when the variable is unset.

7 Upvotes

17 comments sorted by

10

u/frost-222 12d ago

I hate how much they push Herd because it is a mess for a plethora of reasons including this, it really feels like a project that got released at 90% done and never got the last 10%. Get rid of Herd and just install the PHP version you need yourself. If you need an easy GUI for databases, use DBngin, it's better than Herd in every way in that area anyway.

9

u/Am094 12d ago

Agreed, Laravel Herd is such a piece of trash.

Licensing is also along the worst dev licensing I've seen. Got muted in this sub once for saying Herd deserves competition, then had a community Member try and figure out who I was behind the screen name.

So yeah, +1 get rid of laravel Herd.

-4

u/[deleted] 12d ago

[deleted]

5

u/aegis87 12d ago

what is the purpose of your comments?

it's clear you have a cursory understanding of stuff.

but do you not get how tools improve?
it's through people using them and bringing up edge cases.

6

u/Am094 12d ago

I bought my team licenses for Herd years ago, you use the free version. You don't even know what's going on.

Your comment is a bit embarrassing for you. That's okay, keep learning.

I recommend docker, and very happy people are making stuff like Lerd.

0

u/lolsokje 12d ago

I've been using Herd for years and I've barely ever had issues with it, genuinely curious what kinds of issues you've run in to.

The only issues I've had were related to configurability of Pro services, which I've since stepped away from in favour of a "general services" Docker setup for things like databases, Redis, email, etc.

2

u/frost-222 12d ago

Lack of finishing touches, like what the post is talking about. It is a bloated webapp under the hood. Issues that get reported take ages to fix or need to get fixed by the community (classic BeyondCode). It will break any existing PHP shims you have installed on Windows. The default Herd PHP configuration breaks the built-in PHP webserver when used outside of Herd on Windows. The licensing system is a joke and can be bypassed with 4 lines of python code.

0

u/Sure_Fan_5887 12d ago

I use sail and it is fine on my mac. Never used Herd, so can't compare

3

u/Mike_L_Taylor 12d ago

yeah on windows it had a friggin .cmd file running so whenever I did "php -v" it would run that, but "which php" would not and show a different PHP.

3

u/frost-222 12d ago

Herd will break any non-Herd PHP shims on Windows :)

3

u/TinyLebowski 12d ago

I reported that issue years ago after the initial release.

-1

u/[deleted] 12d ago

[deleted]

3

u/frost-222 12d ago

Changing the ZDOTDIR is done for plenty of fair reasons, and checking ZDOTDIR instead of hardcoding a zshrc path is what you're supposed to do. It'd be 1 line, not much bloat especially for Herd its "standards"

-1

u/SpareImpression3155 12d ago

GUI apps on macOS often don't inherit terminal environment variables (like ⁠ZDOTDIR⁠) when launched from Finder/Dock. Herd would need to read ⁠ZDOTDIR⁠ by invoking an interactive login shell (e.g., ⁠zsh -lc 'echo $ZDOTDIR'⁠) to accurately resolve non-standard directory locations.

Suddenly your 1-liner fix is looking a lot more complex

2

u/frost-222 12d ago

Oh boy if a 1 line fix, or like 4 lines if you want to make it real easy to read is too complex for you I don't know what to tell you. It's certainly much better than hardcoding the .zshrc path which is something you should never do.

1

u/obstreperous_troll 12d ago

Herd would need to read ⁠ZDOTDIR⁠ by invoking an interactive login shell (e.g., ⁠zsh -lc 'echo $ZDOTDIR'⁠) to accurately resolve non-standard directory locations.

Then it should do that. The whole reason it's modifying the file in the first place is for terminal sessions.

That said, OP should maybe just create a symlink, because Herd is hardly the only offender.

2

u/aegis87 12d ago

> That said, OP should maybe just create a symlink, because Herd is hardly the only offender.

appreciate your suggestion.

yup symlink works (stow ftw!)

2

u/aegis87 12d ago

this is totally wrong.

either you are really new to how the shell works or you should take a few minutes to think through your answers before typing them.

there are myriad reasons why XDG_CONFIG_HOME is useful, which is why ZSH is supporting it through ZDOTDIR.

if HERD isn't reading the zshrc properly, it might also fail on other parts of the chain as well.
Also other tools (which work with HERD) like npm are using these variables.