eframe_template icon indicating copy to clipboard operation
eframe_template copied to clipboard

fill_template.sh fails on macOS

Open msgilligan opened this issue 1 year ago • 3 comments

The fill_template.sh does not work with the built-in sed command on macOS (/usr/bin/sed) and produces the following error:

Patching files...
sed: 1: "Cargo.toml": invalid command code C

I worked around the issue by installing the Nix package gnused. Once that version of sed is first in my $PATH fill_template.sh works correctly.

msgilligan avatar Sep 16 '24 19:09 msgilligan

I had redone the template in rust so no sed needed and had decided it maybe wasn't worth it as it wasn't that much better than the script. But I can revisit given considering cross platform, if that is actually helpful to someone other than me.

c-git avatar Sep 26 '24 18:09 c-git

At the very least you could just document that macOS users need to install GNU sed. It was pretty easy to figure out, but a comment in the script or elsewhere would IMO resolve this issue and might be simpler than publishing a Rust version.

msgilligan avatar Sep 26 '24 19:09 msgilligan

TLDR

I suspect the original author may not have had experience with macOS and thus didn't know of the differences between the versions of sed. I think the simplest next step is to add a comment as you suggested.

Problems with that solution

But there is also another version that had to be done for windows https://github.com/emilk/eframe_template/pull/153 and now technically we've doubled the number of versions to be maintained along with needing a comment about versions of sed.

Problems I can think of with a rust solution

Rust scripts haven't been stabilized yet and would require nightly to run them. Otherwise I think they would be similar level of difficulty to doing a rust script compared with the current script.

The other option is doing a cargo subcommand but that would require the user to install a binary instead of just run a script again probably not worthwhile unless you start a lot of new projects.

My previous attempt (that I think missed the mark in some regards)

The main reason I didn't make a PR for the version I did was because my information doesn't change much between projects and thus I did something a bit more complicated (which in hindsight was maybe a bit too complicated) that would reuse information. The current version of what I did is online but I do not think it works well yet for the general case.

c-git avatar Sep 26 '24 19:09 c-git

@msgilligan @c-git I ran into the same issue and thought this warranted a comment in the README. Please let me know your thoughts here: #187.

saurabhkaul avatar Apr 03 '25 13:04 saurabhkaul

I think the update to the readme is the best short term mitigation. But I think once rust's single file scripts stabilize we should migrate over.

c-git avatar Apr 03 '25 13:04 c-git