Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Started not working on OSX #65

Closed
shaban opened this issue Dec 13, 2017 · 16 comments
Closed

Getting Started not working on OSX #65

shaban opened this issue Dec 13, 2017 · 16 comments

Comments

@shaban
Copy link

shaban commented Dec 13, 2017

Hello, i was quite curious to see joy in action so i tried the getting started Tutorial to get an idea of how joy works. I ran into problems though. I use normal OSX shell no brew or anything .
What happened was this.

Command:
curl -sfL https://raw.githubusercontent.com/matthewmueller/joy/master/install.sh | sh

Result:
matthewmueller/joy: checking GitHub for latest version matthewmueller/joy: found version 0.1.2 for darwin/amd64 matthewmueller/joy: downloading https://github.com/matthewmueller/joy/releases/download/v0.1.2/joy_0.1.2_darwin_amd64.tar.gz curl --fail -sSL -o /var/folders/7k/7fcv6h1j4g92mh2ztmcpts6r0000gp/T//joy_0.1.2_darwin_amd64.tar.gz https://github.com/matthewmueller/joy/releases/download/v0.1.2/joy_0.1.2_darwin_amd64.tar.gz matthewmueller/joy: verifying checksums curl --fail -sSL -o /var/folders/7k/7fcv6h1j4g92mh2ztmcpts6r0000gp/T//joy_0.1.2_checksums.txt https://github.com/matthewmueller/joy/releases/download/v0.1.2/joy_0.1.2_checksums.txt install: chmod 755 /usr/local/bin: Operation not permitted install: /usr/local/bin//joy: Permission denied

This time as super user (which doesn't do a lot since i should sudo the resulting install.sh i guess):
sudo curl -sfL https://raw.githubusercontent.com/matthewmueller/joy/master/install.sh | sh

Result:
matthewmueller/joy: checking GitHub for latest version matthewmueller/joy: found version 0.1.2 for darwin/amd64 matthewmueller/joy: downloading https://github.com/matthewmueller/joy/releases/download/v0.1.2/joy_0.1.2_darwin_amd64.tar.gz curl --fail -sSL -o /var/folders/7k/7fcv6h1j4g92mh2ztmcpts6r0000gp/T//joy_0.1.2_darwin_amd64.tar.gz https://github.com/matthewmueller/joy/releases/download/v0.1.2/joy_0.1.2_darwin_amd64.tar.gz matthewmueller/joy: verifying checksums curl --fail -sSL -o /var/folders/7k/7fcv6h1j4g92mh2ztmcpts6r0000gp/T//joy_0.1.2_checksums.txt https://github.com/matthewmueller/joy/releases/download/v0.1.2/joy_0.1.2_checksums.txt install: chmod 755 /usr/local/bin: Operation not permitted install: /usr/local/bin//joy: Permission denied

Now by downloading from releases putting joy executable into GOPATH/bin it seems to work though there is still some rough edges:
joy run main.go
Result:
downloading headless chrome (this only needs to be done once) /Users/shaban/Library/Preferences/joy/internal/runtime/runtime.go:3:8: could not import github.com/matthewmueller/joy/macro (cannot find package "github.com/matthewmueller/joy/macro" in any of: /usr/local/go/src/github.com/matthewmueller/joy/macro (from $GOROOT) /Users/shaban/go/src/github.com/matthewmueller/joy/macro (from $GOPATH)) ⨯ parse error: load error: unable to load the go package: couldn't load packages due to errors: runtime

Now remedying the situation by manually go getting:
go get github.com/matthewmueller/joy/macro

Another Try:
joy run main.go
Result working as expected:
github.com/matthewmueller/joy/macro hi world!

Now let's try the serve Command:
joy serve main.go
Result:
cannot find package "../../Downloads" in: /Users/Downloads FATAL[0000] error serving: load error: unable to load the go package: couldn't load packages due to errors: ../../Downloads
Downloads just happens to be the directory i put my main.go in.

So either serve command only works with an installable package in GOPATH or am i missing something?

@matthewmueller
Copy link
Owner

@shaban thanks for compiling this! This is a good list to make sure I handle all the cases.

I made some assumptions about GOPATH that didn't hold up once you're shipping I binary

I have a fix ready that I just need to cleanup. Should be a much better experience tomorrow :-)

@shaban
Copy link
Author

shaban commented Dec 13, 2017

Thanks for the speedy response.
Looking forward to trying it out.

@matthewmueller
Copy link
Owner

Alrighty, could you please try running that command again and let me know if it works?

curl -sfL https://raw.githubusercontent.com/matthewmueller/joy/master/install.sh | sh

@loilo
Copy link

loilo commented Dec 14, 2017

I had the same problem, for me it works now. 🎉
Would be nice to be confirmed by someone else though.

@matthewmueller
Copy link
Owner

matthewmueller commented Dec 14, 2017

FYI, still need to fix up this case:

Now let's try the serve Command:
joy serve main.go
Result:
cannot find package "../../Downloads" in: /Users/Downloads FATAL[0000] error serving: load error: unable to load the go package: couldn't load packages due to errors: ../../Downloads
Downloads just happens to be the directory i put my main.go in.

@shaban
Copy link
Author

shaban commented Dec 14, 2017

curl -sfL https://raw.githubusercontent.com/matthewmueller/joy/master/install.sh | sh

Didn't work :-(
matthewmueller/joy: checking GitHub for latest version matthewmueller/joy: found version 0.1.4 for darwin/amd64 matthewmueller/joy: downloading https://github.com/matthewmueller/joy/releases/download/v0.1.4/joy_0.1.4_darwin_amd64.tar.gz curl --fail -sSL -o /var/folders/7k/7fcv6h1j4g92mh2ztmcpts6r0000gp/T//joy_0.1.4_darwin_amd64.tar.gz https://github.com/matthewmueller/joy/releases/download/v0.1.4/joy_0.1.4_darwin_amd64.tar.gz matthewmueller/joy: verifying checksums curl --fail -sSL -o /var/folders/7k/7fcv6h1j4g92mh2ztmcpts6r0000gp/T//joy_0.1.4_checksums.txt https://github.com/matthewmueller/joy/releases/download/v0.1.4/joy_0.1.4_checksums.txt install: chmod 755 /usr/local/bin: Operation not permitted install: /usr/local/bin//joy: Permission denied

Trying to make it work by breaking down the steps:
curl https://raw.githubusercontent.com/matthewmueller/joy/master/install.sh > install.sh
sudo sh install.sh

Result:
matthewmueller/joy: checking GitHub for latest version matthewmueller/joy: found version 0.1.4 for darwin/amd64 matthewmueller/joy: downloading https://github.com/matthewmueller/joy/releases/download/v0.1.4/joy_0.1.4_darwin_amd64.tar.gz curl --fail -sSL -o /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.KZTBXNOF/joy_0.1.4_darwin_amd64.tar.gz https://github.com/matthewmueller/joy/releases/download/v0.1.4/joy_0.1.4_darwin_amd64.tar.gz matthewmueller/joy: verifying checksums curl --fail -sSL -o /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.KZTBXNOF/joy_0.1.4_checksums.txt https://github.com/matthewmueller/joy/releases/download/v0.1.4/joy_0.1.4_checksums.txt matthewmueller/joy: installed as /usr/local/bin/joy

Trying out if it worked:
joy run main.go
Result OK:
hi world!

Just out of curiosity.

If making your project go-gettable was an option for you, you would probably avoid a lot of minefields since go users are already equipped with a GOPATH and if there is none i think newest go-version comes with a default GOPATH.

And then in most cases GOPATH/bin is inside PATH which means you can ab/use it for all kinds of executables needed like the headless chrome and whatnot. On top you'd benefit from all the abstractions go's build system offers you. On a sidenote what i really love about go is that i know where the files land and how to get rid of them. This makes go users less reluctant to try out some package because they know:

  • it installs easily
  • they can get rid of it easily
  • and their beloved computer doesn't look like node_modules/zillions/of/files ;)

FYI an interesting discussion here about GOPATH and the new default GOPATH and what people use in general as GOPATH.

And the tl;dr; version here
The only drawback is that you would have to rely on a recent go version (1.8)

@matthewmueller
Copy link
Owner

matthewmueller commented Dec 14, 2017

@shaban I think you're right about this and I am overcomplicating it. A bit surprised /usr/local/bin isn't writable, is that normal? I'm just using https://github.com/goreleaser/godownloader here, but that seems like it's going to be a problem for non-go users.

For some reason, when I first read 1.8 I thought it was coming out, not already out 😅. Then I realized I'm already on 1.9.2! I think relying on 1.8+ is okay, since this is a new project.

The state I need on the client's machine is:


1. Some uncompiled Go source files (stdlib + runtime), so they can be compiled with the rest of the client's program. I may be able to ship .a files here, but I haven't looked into that

For this one, maybe I can just put them where they'd normally be?

  • Check what happens if you go get on top of that sparse directory?

UPDATE this doesn't work unfortunately:

testpkg : ls
macro/  stdlib/
testpkg : go get -u -v github.com/matthewmueller/testpkg/...
package github.com/matthewmueller/testpkg/macro: directory "/Users/matt/go/src/github.com/matthewmueller/testpkg/macro" is not using a known version control system
package github.com/matthewmueller/testpkg/stdlib: directory "/Users/matt/go/src/github.com/matthewmueller/testpkg/stdlib" is not using a known version control system
package github.com/matthewmueller/testpkg/stdlib/fmt: directory "/Users/matt/go/src/github.com/matthewmueller/testpkg/stdlib/fmt" is not using a known version control system
  • Does it still work with forks?

2. I need a version of headless chrome that we control so we can make sure it's consistent.

I think you're right that I can stick this in $GOPATH/bin, creating that directory if it doesn't already exist. Since we know where it is, it doesn't need to be in the user's $PATH.

  • Move headless chrome into $GOPATH/bin

Update I think i'll just stick this one in the same location as the source since I don't actually need it to be in the path.


Does that make sense?

@shaban
Copy link
Author

shaban commented Dec 14, 2017

ok i wrote something stupid here before and i hope you haven't seen it yet ;)

i overlooked something and i tried it out now the go way and good news it worked out of the box.
go get github.com/matthewmueller/joy/cmd/joy
then
joy run main.go
• downloading headless chrome (this only needs to be done once) hi World!
⨯ error flushing error=missing stream name
so the only oddity is the last line otherwise it works flawlessly out of the box.

source of the error is in your analytics backend

This was referenced Dec 15, 2017
@matthewmueller
Copy link
Owner

matthewmueller commented Dec 16, 2017

ahh yep, that's fixed in master. I've been adding a bunch of tests to this pipeline as well as simplifying things, so I think the next release will be pretty solid

@matthewmueller
Copy link
Owner

matthewmueller commented Dec 17, 2017

Okay, I think I've squashed all the major installation issues in the latest release 0.1.6 🎉

  • install the master development version with: go get -u -v github.com/matthewmueller/joy...

  • or upgrade to the latest production release: joy upgrade or curl -sfL https://raw.githubusercontent.com/matthewmueller/joy/master/install.sh | sh

One thing I didn't add in was a fix if /usr/local/bin is not writable, I'm not sure yet if that's something we ought to be fixing.

If you were having troubles, please try again and let me know how it goes!

@shaban
Copy link
Author

shaban commented Dec 18, 2017

Well i go the go get way, so that it lands where i expect it.
And that works really nicely.
The usr/local problem doesn't happen at all to me now.

IMHO in modern unix /usr/... should be used by package manager(s)/OS and thats it.

@matthewmueller
Copy link
Owner

matthewmueller commented Dec 19, 2017

/cc @caarlos0

Any thoughts on this? I'm using godownloader which installs to /usr/local/bin. Should this be changed? I'm not sure where else it'd be placed though.

@shaban
Copy link
Author

shaban commented Dec 19, 2017

Just a question, since i assume you want to have a prospering ecosystem of reusable code / components etc. at some point.

Why not use $HOME/joy on linux and userprofile/joy on windows.
This place could be a stub for some sort of package system later on.

@matthewmueller
Copy link
Owner

matthewmueller commented Dec 19, 2017

Most of the shared components and things will be in $GOPATH, we just have a few things like the runtime which need to be compiled alongside the source. I'm definitely open to changing this, in fact we could stick them in $GOPATH too, but they just can't be in the exact same place as joy's source because they'd break go get, so maybe under .joy instead.

Not a huge fan of $HOME/... clutter but I could be convinced if others prefer that. Right now, I'm using these settings: https://github.com/sindresorhus/env-paths to choose the config path.

This is a bit different than the problem with /usr/local/bin, longer-term we'd probably just want brew install joy or os-specific package installers (e.g. joy.pkg)

@caarlos0
Copy link

Any thoughts on this? I'm using godownloader which installs to /usr/local/bin. Should this be changed? I'm not sure where else it'd be placed though.

it should be ok to install to /usr/local/bin, either way, it can be overwritten with the -b flag:

curl -sfL https://raw.githubusercontent.com/matthewmueller/joy/master/install.sh | sh -s -- -b /tmp

@matthewmueller
Copy link
Owner

matthewmueller commented Dec 19, 2017

@caarlos0 ahh okay awesome, thanks for chiming in!

Going to close this since I think this issue should be solved. Will add a note in the readme about -b if anyone else runs into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants