PhantomJS: getting "Killed: 9" for anything I'm trying
Asked Answered
M

6

66

Just installed phantomjs, mac os x yosemite. Whenever I run /bin/phantomjs, with any parameter, I get Killed: 9. Any idea?

Marozas answered 1/2, 2015 at 20:59 Comment(0)
R
63

re: running phantomjs on osx yosemite, download the build/fix found at:

https://github.com/eugene1g/phantomjs/releases

original issue:

https://github.com/ariya/phantomjs/issues/12928

Remnant answered 1/2, 2015 at 21:57 Comment(3)
So basically it's not exactly this link above, but the link that is linked in the link above (lol) which is github.com/eugene1g/phantomjs/releasesRicercar
Place extracted phantomjs script inside e. g. /usr/local/bin or other $PATH related folder.Assurance
Anyone know why this hasn't been merged into the main repo yet?Inexact
T
99
  1. Install UPX. UPX is an executable packer and unpacker

    $ brew install upx
    
  2. Unpack the phantomjs executable

    $ upx -d phantomjs-2.0.0-macosx/bin/phantomjs
    
  3. Run the phantomjs executable

    $ ./phantomjs-2.0.0-macosx/bin/phantomjs
    
Trunnion answered 6/3, 2015 at 0:7 Comment(8)
Thanks, works perfectly for me. @AndrewT. upx is an executable packer, running upx -d reverses the packing of the executable and restores it back to its original form (kind of like unzipping a file)Trimming
Note to others: your path to phantomjs might be different. I had been keeping my binary in /usr/bin/phantomsAluin
This is the correct answer. The other should have its checkmark removed, and it should be put on this answer.Entopic
Works perfectly on OS 10.11Pasticcio
@Trunnion thanks, it works. but how? why do we need to unpack it?Croaker
There may be a bug in packaging script of Phantom.JS. Their documentation indicates that executables are packed only on Windows. Unfortunately, they are packed on Mac too. Please see: phantomjs.org/release-preparation.html. ``` Pack phantomjs.exe with UPX: upx %PHANTOMJSDEPLOYDIR%\phantomjs.exe Zip the contents of %PHANTOMJSDEPLOYDIR%. ```Trunnion
If you've installed phantomjs 2 using brew cask install phantomjs, run upx -d /opt/homebrew-cask/Caskroom/phantomjs/2.0.0/phantomjs-2.0.0-macosx/bin/phantomjsIyeyasu
$ brew install upx Killed: 9Rabideau
R
63

re: running phantomjs on osx yosemite, download the build/fix found at:

https://github.com/eugene1g/phantomjs/releases

original issue:

https://github.com/ariya/phantomjs/issues/12928

Remnant answered 1/2, 2015 at 21:57 Comment(3)
So basically it's not exactly this link above, but the link that is linked in the link above (lol) which is github.com/eugene1g/phantomjs/releasesRicercar
Place extracted phantomjs script inside e. g. /usr/local/bin or other $PATH related folder.Assurance
Anyone know why this hasn't been merged into the main repo yet?Inexact
P
2

The eugene1g release and UPX install didn't work for me on El Capitan. What did work for me was installing PhantomJS using the phantomjs2 NPM package:

npm install phantomjs2

# Optional: symlink in a dir that's on my PATH:
ln -s /usr/local/lib/node_modules/phantomjs2/lib/phantom/bin/phantomjs /usr/local/bin/phantomjs 
Prithee answered 7/10, 2015 at 10:21 Comment(0)
T
2

$ npm install -g phantomjs worked for me on El Capitan.

The npm package isn't "official", it's maintained by a contributor, but it works. https://github.com/eugene1g/phantomjs

Twomey answered 7/1, 2016 at 16:0 Comment(0)
P
1

Blunt re-install using brew

Whatever is in /usr/local/bin/phantomjs has stopped working for you.

If you've got ~30mins to spare you can reinstall and relink using brew:

  # unlink old version
  brew unlink phantomjs

  # reinstall phantomjs
  brew update && brew install phantomjs

  # (You may wish to make a refreshing herbal tea or similar beverage here...)

  # Update link to usr/local/bin
  brew link --overwrite phantomjs

If you want to test what brew will do with overwrite you can run

 brew link --overwrite --dry-run phantomjs 
Phosphoric answered 7/10, 2015 at 13:54 Comment(0)
G
0

Sometimes this happens when your current shell process is killed.

I was in tmux using brew update, and brew updated tmux and bash, then bang! Everything in tmux just returns Killed: 9.

Guidon answered 23/8, 2020 at 16:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.