pact-foundation / pact-ruby-standalone

A standalone pact command line executable using the ruby pact implementation and Travelling Ruby
https://pact.io
MIT License
39 stars 32 forks source link

Uanble to run the pact-mock-service on Mac 10.15 version #53

Closed PGhalke closed 4 years ago

PGhalke commented 4 years ago

Pre issue-raising checklist

I have already (please mark the applicable with an x):

Software versions

Expected behaviour

$ ./pact-mock-service --help start should have started the mock service.

Actual behaviour

$ ./pact-mock-service --help start ended with the error: $ ./pact-mock-service --help start /pact/lib/ruby/bin/ruby: line 6: /pact/lib/ruby/bin.real/ruby: No such file or directory

Steps to reproduce

I was trying to work with the Pact-Mock-Server as per the instructions given in the ReadMe at https://github.com/pact-foundation/pact-ruby-standalone/releases/tag/v1.84.0

  1. Downloaded the pact tar available for Mac OS in the link mentioned above, which is pact-1.84.0-osx.tar.gz.

  2. Mac's Achive Utility tools untars the above mentioned tar into the folder with structure pact pact/bin/ pact/lib/ Readme.md

  3. After the untar, when i try to execute the command $ ./pact-mock-service --help start /pact/lib/ruby/bin/ruby: line 6: /Users/preethighalke/pact/lib/ruby/bin.real/ruby: No such file or directory the command fails with the above error.

Relevent log files

NA

PGhalke commented 4 years ago

@bethesque FYI. ^^

mefellows commented 4 years ago

So on my Mac (osx 10.15.4) running the exact commands described in that standalone release work (running from /tmp):

curl -LO https://github.com/pact-foundation/pact-ruby-standalone/releases/download/v1.84.0/pact-1.84.0-osx.tar.gz
tar xzf pact-1.84.0-osx.tar.gz
cd pact/bin
./pact-mock-service --help start
./pact-provider-verifier --help verify

Result:

out

mefellows commented 4 years ago

As an aside, this package is used by many of our tools (e.g. Pact JS, Pact Go, Pact .NET). If the package didn't work on a Mac, we would have found out by now.

So it is likely something related to your configuration.

Could you please provide a way for us to reproduce your issue?

PGhalke commented 4 years ago

Thanks @mefellows for the update, i tried to exactly do the steps you mentioned above and now it works.

The only difference was earlier I used the Archive Utility tool to extract the tar contents and run the command, unlike now where i used "tar xzf "

PGhalke commented 4 years ago

I tried extracting the tar again with Archive utility and i see the issue happening again

$ cd pact/bin/ $ ./pact-mock-service --help start Killed: 9 $ ./pact-mock-service --help start /pact/lib/ruby/bin/ruby: line 6: pact/lib/ruby/bin.real/ruby: No such file or directory

so looks like we might have to use the "tar" command to untar the package, which make it work.

Many Thanks

mefellows commented 4 years ago

The issue seems to be related to a recent security change in Mac OSX.

Because you extracted the contents using the Archine Utility, somehow, OSX knows it was downloaded from the internet and is sandboxing the binary. I've seen this before with other downloadable files. You need to right-click and then open, but for this case, just install using the CLI.

Screen Shot 2020-05-19 at 2 03 22 pm

Screen Shot 2020-05-19 at 2 03 13 pm

bethesque commented 4 years ago

There is a brew version of the pact-ruby-standalone https://github.com/pact-foundation/homebrew-pact-ruby-standalone that would side step this issue

PGhalke commented 4 years ago

Thanks @mefellows and @bethesque.