Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install templ in macos & windows. Error:- templ not found

Tags:

echo

go

docs says.

  1. go install github.com/a-h/templ/cmd/templ@latest [This does not work.]

what I did. 1.

git clone https://github.com/a-h/templ.git [in /tmp]

cd cmd/templ && go install

still Error.

Solution I came up with. 1.

alias templ=$HOME/go/bin/templ [also added in ~/.zshrc]

why this does not work

go install github.com/a-h/templ/cmd/templ@latest

Edit:- I encountered this in windows too. Here are the steps I did to resolve this.

  1. Download the latest binary from github repo in $HOME/tmp Folder.
 2. Extract it in $HOME/tmp and copy it.
 3. Paste it in Folder where Golang is installed, i.e. Go/bin/[here].

In my case it was "C:\Program Files\Go\bin" I found it using which go I also have this path configured in System Environment Variable.

like image 888
c9der Avatar asked Nov 04 '25 08:11

c9der


1 Answers

go install worked just fine as you can see from the alias you created. It only works because the installation was successful.

Add export PATH="$PATH:$HOME/go/bin" to your ~/.zshrc file to add Go's default installation folder to PATH. That way all binaries that are installed with go install will be available globally.

like image 115
TehSphinX Avatar answered Nov 07 '25 10:11

TehSphinX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!