Homebrew / homebrew-cask

🍻 A CLI workflow for the administration of macOS applications distributed as binaries
https://brew.sh
BSD 2-Clause "Simplified" License
20.94k stars 10.72k forks source link

metasploit install fails when linking binary #31874

Closed commitay closed 7 years ago

commitay commented 7 years ago

General troubleshooting steps

Description of issue

metasploit install fails when Linking Binary errors with Operation not permitted.

brew cask install metasploit --verbose --debug fails with the same error on two computers (10.12.4 - CLT 8.3 and 10.12.3 - CLT 8.2) with up to date HB and in new VM (10.12.4 - CLT 8.3) with fresh HB install.

The cask itself is less than two weeks old and installed without error for me about a week ago.

I've manually installed the first version of this cask #31311 and the newest version from rapid7 metasploit-framework-4.14.8+20170404092313-1rapid7-1.pkg and the permissions after install appear to be the same. I've included the permissions at the end.

Outputs below are from the VM.

Output of your command with --verbose --debug

$ brew cask install metasploit --verbose --debug
==> Tapping caskroom/cask
git clone https://github.com/caskroom/homebrew-cask /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask --depth=1
Cloning into '/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask'...
remote: Counting objects: 3734, done.
remote: Compressing objects: 100% (3718/3718), done.
remote: Total 3734 (delta 36), reused 376 (delta 12), pack-reused 0
Receiving objects: 100% (3734/3734), 1.25 MiB | 1.20 MiB/s, done.
Resolving deltas: 100% (36/36), done.
Tapped 0 formulae (3,743 files, 3.9MB)
git config --local --replace-all homebrew.private false
==> Creating Cache at /Users/commitay/Library/Caches/Homebrew/Cask
==> Creating Caskroom at /usr/local/Caskroom
==> We'll set permissions properly so we won't need sudo in the future
==> Executing: ["/usr/bin/sudo", "-E", "--", "/bin/mkdir", "-p", "/usr/local/Caskroom"]
Password:
==> Executing: ["/usr/bin/sudo", "-E", "--", "/bin/chmod", "g+rwx", "/usr/local/Caskroom"]
==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "commitay", "/usr/local/Caskroom"]
==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/bin/chgrp", "admin", "/usr/local/Caskroom"]
==> Hbc::Installer#install
==> Printing caveats
==> Hbc::Installer#fetch
==> Satisfying dependencies
==> Installing Formula dependencies from Homebrew
nmap ... ==> Executing: ["/usr/local/bin/brew", "list", "--versions", "nmap"]
==> Executing: ["/usr/local/bin/brew", "install", "nmap"]
done
postgresql ... ==> Executing: ["/usr/local/bin/brew", "list", "--versions", "postgresql"]
==> Executing: ["/usr/local/bin/brew", "install", "postgresql"]
done
complete
==> Downloading
==> Downloading https://osx.metasploit.com/metasploit-framework-4.14.6+20170331092309-1rapid7-1.pkg
==> Calling curl with args ["https://osx.metasploit.com/metasploit-framework-4.14.6+20170331092309-1rapid7-1.pkg", "-C", "0", "-o", "#<Pathname:/Users/commitay/Library/Caches/Homebrew/Cask/metasploit--4.14.6,20170331092309.pkg.incomplete>"]
/usr/bin/curl --remote-time --location --user-agent Homebrew/1.1.12 (Macintosh; Intel macOS 10.12.4) curl/7.51.0 --fail https://osx.metasploit.com/metasploit-framework-4.14.6+20170331092309-1rapid7-1.pkg -C 0 -o /Users/commitay/Library/Caches/Homebrew/Cask/metasploit--4.14.6,20170331092309.pkg.incomplete
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  154M  100  154M    0     0   939k      0  0:02:48  0:02:48 --:--:-- 1006k
==> Downloaded to -> /Users/commitay/Library/Caches/Homebrew/Cask/metasploit--4.14.6,20170331092309.pkg
==> Verifying download
==> Determining which verifications to run for Cask metasploit
==> Checking for verification class Hbc::Verify::Checksum
==> 1 verifications defined
Hbc::Verify::Checksum
==> Running verification of class Hbc::Verify::Checksum
==> Verifying checksum for Cask metasploit
==> SHA256 checksums match
==> Hbc::Installer#stage
==> Extracting primary container
==> Determining which containers to use based on filetype
==> Checking container class Hbc::Container::Pkg
==> Using container class Hbc::Container::Pkg for /Users/commitay/Library/Caches/Homebrew/Cask/metasploit--4.14.6,20170331092309.pkg
==> Executing: ["/usr/bin/ditto", "--", "/Users/commitay/Library/Caches/Homebrew/Cask/metasploit--4.14.6,20170331092309.pkg", "/usr/local/Caskroom/metasploit/4.14.6,20170331092309/metasploit-framework-4.14.6+20170331092309-1rapid7-1.pkg"]
==> Creating metadata directory /usr/local/Caskroom/metasploit/.metadata/4.14.6,20170331092309/20170404201719.818
==> Creating metadata subdirectory /usr/local/Caskroom/metasploit/.metadata/4.14.6,20170331092309/20170404201719.818/Casks
==> Installing artifacts
==> Determining which artifacts are present in Cask metasploit
==> 3 artifact/s defined
#<Hbc::Artifact::Pkg:0x007fc666722958>
#<Hbc::Artifact::Binary:0x007fc6667228e0>
#<Hbc::Artifact::Uninstall:0x007fc666722868>
==> Installing artifact of class Hbc::Artifact::Pkg
==> Running installer for metasploit; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", "/usr/local/Caskroom/metasploit/4.14.6,20170331092309/metasploit-framework-4.14.6+20170331092309-1rapid7-1.pkg", "-target", "/", "-verboseR"]
==> installer: Package name is Metasploit-framework
==> installer: Installing at base path /
==> installer:PHASE:Preparing for installation…
==> installer:PHASE:Preparing the disk…
==> installer:PHASE:Preparing Metasploit-framework…
==> installer:PHASE:Waiting for other installations to complete…
==> installer:PHASE:Configuring the installation…
==> installer:STATUS:
==> installer:%4.493373
==> installer:PHASE:Writing files…
==> installer:%6.587818
==> installer:PHASE:Writing files…
==> installer:%9.224563
==> installer:PHASE:Writing files…
==> installer:%10.542936
==> installer:PHASE:Writing files…
==> installer:%11.861309
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%13.179682
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%14.498055
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%15.816427
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%22.408291
==> installer:PHASE:Writing files…
==> installer:%26.363410
==> installer:PHASE:Writing files…
==> installer:%30.318528
==> installer:PHASE:Writing files…
==> installer:%31.636901
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%32.955274
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%35.592019
==> installer:PHASE:Writing files…
==> installer:%38.228765
==> installer:PHASE:Writing files…
==> installer:%40.865510
==> installer:PHASE:Writing files…
==> installer:%42.183883
==> installer:PHASE:Writing files…
==> installer:%43.502256
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%44.820629
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%46.139001
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%48.775747
==> installer:PHASE:Writing files…
==> installer:%50.094120
==> installer:PHASE:Writing files…
==> installer:%51.412493
==> installer:PHASE:Writing files…
==> installer:%52.730865
==> installer:PHASE:Writing files…
==> installer:%54.049238
==> installer:PHASE:Writing files…
==> installer:%55.367611
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:PHASE:Writing files…
==> installer:%81.753238
==> installer:PHASE:Writing package receipts…
==> installer:%82.405864
==> installer:PHASE:Writing package receipts…
==> installer:%83.067902
==> installer:PHASE:Writing package receipts…
==> installer:PHASE:Validating packages…
==> installer:%97.750000
==> installer:STATUS:Running installer actions…
==> installer:STATUS:
==> installer:PHASE:Finishing the Installation…
==> installer:STATUS:
==> installer:%100.000000
==> installer:PHASE:The software was successfully installed.
==> installer: The install was successful.
==> Installing artifact of class Hbc::Artifact::Binary
==> Linking Binary 'metasploit-aggregator' to '/usr/local/bin/metasploit-aggregator'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/metasploit-aggregator", "/usr/local/bin/metasploit-aggregator"]
==> Purging files for version 4.14.6,20170331092309 of Cask metasploit
Error: Operation not permitted - /opt/metasploit-framework/bin/metasploit-aggregator
Follow the instructions here:
  https://github.com/caskroom/homebrew-cask#reporting-bugs
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1333:in `chmod'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1333:in `chmod'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:975:in `block in chmod'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:974:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:974:in `chmod'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/binary.rb:12:in `link'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb:48:in `block in each_artifact'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/set.rb:232:in `each_key'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/set.rb:232:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb:46:in `each_artifact'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb:15:in `install_phase'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/binary.rb:7:in `install_phase'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:144:in `block in install_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:141:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:141:in `install_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:87:in `install'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:25:in `block in install_casks'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:19:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:19:in `install_casks'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:10:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:115:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:158:in `process'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:91:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:169:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:169:in `rescue in process'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:149:in `process'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:91:in `<main>'

Output of brew cask doctor

==> Homebrew-Cask Version
Homebrew-Cask 1.1.12
caskroom/homebrew-cask (git revision 4472; last commit 2017-04-04)
==> Homebrew-Cask Install Location
<NONE>
==> Homebrew-Cask Staging Location
/usr/local/Caskroom
==> Homebrew-Cask Cached Downloads
~/Library/Caches/Homebrew/Cask (1 files, 154.4MB)
==> Homebrew-Cask Taps:
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask (3629 casks)
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core (0 casks)
==> Contents of $LOAD_PATH
/usr/local/Homebrew/Library/Homebrew/cask/lib
/usr/local/Homebrew/Library/Homebrew
/Library/Ruby/Site/2.0.0
/Library/Ruby/Site/2.0.0/x86_64-darwin16
/Library/Ruby/Site/2.0.0/universal-darwin16
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin16
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/universal-darwin16
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/x86_64-darwin16
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin16
==> Environment Variables
LANG="en_AU.UTF-8"
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Homebrew/Library/Homebrew/shims/scm"
SHELL="/bin/bash"

Output of brew doctor

Your system is ready to brew.

Output of brew config

HOMEBREW_VERSION: 1.1.12
ORIGIN: https://github.com/Homebrew/brew
HEAD: 8ea778f7c7ea790694485030d105a92a9416ef33
Last commit: 2 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5ed21bf15977a02a7bb6ac6b80c38a0c393dbee5
Core tap last commit: 53 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: dual-core 64-bit sandybridge
Homebrew Ruby: 2.0.0-p648
Clang: 8.1 build 802
Git: 2.11.0 => /Library/Developer/CommandLineTools/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
macOS: 10.12.4-x86_64
Xcode: N/A
CLT: 8.3.0.0.1.1490382677
X11: N/A

File permissions

current metasploit cask
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 metasploit-aggregator
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfbinscan
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfconsole
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfd
-rwxr-xr-x   1 root  wheel   586B 31 Mar 19:38 msfdb
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfelfscan
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfmachscan
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfpescan
-rwxr-xr-x   1 root  wheel   1.1K 31 Mar 19:38 msfremove
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfrop
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfrpc
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfrpcd
-rwxr-xr-x   1 root  wheel   5.3K 31 Mar 19:38 msfupdate
-rwxr-xr-x   1 root  wheel   2.9K 31 Mar 19:38 msfvenom
original metasploit cask
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 metasploit-aggregator
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfbinscan
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfconsole
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfd
-rwxr-xr-x   1 root  wheel   586B 25 Mar 19:37 msfdb
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfelfscan
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfmachscan
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfpescan
-rwxr-xr-x   1 root  wheel   1.1K 25 Mar 19:37 msfremove
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfrop
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfrpc
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfrpcd
-rwxr-xr-x   1 root  wheel   5.3K 25 Mar 19:37 msfupdate
-rwxr-xr-x   1 root  wheel   2.9K 25 Mar 19:37 msfvenom
newest metasploit version
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 metasploit-aggregator
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfbinscan
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfconsole
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfd
-rwxr-xr-x   1 root  wheel   586B  4 Apr 19:38 msfdb
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfelfscan
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfmachscan
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfpescan
-rwxr-xr-x   1 root  wheel   1.1K  4 Apr 19:38 msfremove
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfrop
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfrpc
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfrpcd
-rwxr-xr-x   1 root  wheel   5.3K  4 Apr 19:38 msfupdate
-rwxr-xr-x   1 root  wheel   2.9K  4 Apr 19:38 msfvenom
miccal commented 7 years ago

Problem verified, but I am not sure how to fix it.

Running the command "$(brew --repository)/Library/Taps/caskroom/homebrew-cask/developer/bin/list_payload_in_pkg" yields (among other things):

/bin/metasploit-aggregator
/bin/msfbinscan
/bin/msfconsole
/bin/msfd
/bin/msfdb
/bin/msfelfscan
/bin/msfmachscan
/bin/msfpescan
/bin/msfremove
/bin/msfrop
/bin/msfrpc
/bin/msfrpcd
/bin/msfupdate
/bin/msfvenom
commitay commented 7 years ago

Thank you for checking @miccal. I just tried #31877 and it produces the same error.

I can reproduce this error with other casks vfuse and karabiner.

All three are pkg installs with a binary that points directly to a location rather that a binary "#{appdir}/calibre.app/Contents/MacOS/calibre" or binary 'rar/rar'.

I'm not sure if this actually means anything but it's the only thing I can see that they have in common.

I've tried a few casks with binary - vmware-fusion, calibre, rar, happygrep, qiniu-devtools - all install without error.

vfuse ``` brew cask install vfuse --verbose --debug ==> Tapping caskroom/cask git clone https://github.com/caskroom/homebrew-cask /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask --depth=1 Cloning into '/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask'... remote: Counting objects: 3734, done. remote: Compressing objects: 100% (3718/3718), done. remote: Total 3734 (delta 36), reused 376 (delta 12), pack-reused 0 Receiving objects: 100% (3734/3734), 1.25 MiB | 1.10 MiB/s, done. Resolving deltas: 100% (36/36), done. Tapped 0 formulae (3,743 files, 3.9MB) git config --local --replace-all homebrew.private false ==> Creating Cache at /Users/commitay/Library/Caches/Homebrew/Cask ==> Creating Caskroom at /usr/local/Caskroom ==> We'll set permissions properly so we won't need sudo in the future ==> Executing: ["/usr/bin/sudo", "-E", "--", "/bin/mkdir", "-p", "/usr/local/Caskroom"] Password: ==> Executing: ["/usr/bin/sudo", "-E", "--", "/bin/chmod", "g+rwx", "/usr/local/Caskroom"] ==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "commitay", "/usr/local/Caskroom"] ==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/bin/chgrp", "admin", "/usr/local/Caskroom"] ==> Hbc::Installer#install ==> Printing caveats ==> Caveats Cask vfuse installs files under "/usr/local". The presence of such files can cause warnings when running "brew doctor", which is considered to be a bug in Homebrew-Cask. ==> Hbc::Installer#fetch ==> Downloading ==> Downloading https://github.com/chilcote/vfuse/releases/download/1.0.3/vfuse-1.0.3.pkg ==> Calling curl with args ["https://github.com/chilcote/vfuse/releases/download/1.0.3/vfuse-1.0.3.pkg", "-C", "0", "-o", "#"] /usr/bin/curl --remote-time --location --user-agent Homebrew/1.1.12 (Macintosh; Intel macOS 10.12.4) curl/7.51.0 --fail https://github.com/chilcote/vfuse/releases/download/1.0.3/vfuse-1.0.3.pkg -C 0 -o /Users/commitay/Library/Caches/Homebrew/Cask/vfuse--1.0.3.pkg.incomplete % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 592 0 592 0 0 229 0 --:--:-- 0:00:02 --:--:-- 229 100 17179 100 17179 0 0 1823 0 0:00:09 0:00:09 --:--:-- 3994 ==> Downloaded to -> /Users/commitay/Library/Caches/Homebrew/Cask/vfuse--1.0.3.pkg ==> Verifying download ==> Determining which verifications to run for Cask vfuse ==> Checking for verification class Hbc::Verify::Checksum ==> 1 verifications defined Hbc::Verify::Checksum ==> Running verification of class Hbc::Verify::Checksum ==> Verifying checksum for Cask vfuse ==> SHA256 checksums match ==> Hbc::Installer#stage ==> Extracting primary container ==> Determining which containers to use based on filetype ==> Checking container class Hbc::Container::Pkg ==> Using container class Hbc::Container::Pkg for /Users/commitay/Library/Caches/Homebrew/Cask/vfuse--1.0.3.pkg ==> Executing: ["/usr/bin/ditto", "--", "/Users/commitay/Library/Caches/Homebrew/Cask/vfuse--1.0.3.pkg", "/usr/local/Caskroom/vfuse/1.0.3/vfuse-1.0.3.pkg"] ==> Creating metadata directory /usr/local/Caskroom/vfuse/.metadata/1.0.3/20170404225728.343 ==> Creating metadata subdirectory /usr/local/Caskroom/vfuse/.metadata/1.0.3/20170404225728.343/Casks ==> Installing artifacts ==> Determining which artifacts are present in Cask vfuse ==> 3 artifact/s defined # # # ==> Installing artifact of class Hbc::Artifact::Pkg ==> Running installer for vfuse; your password may be necessary. ==> Package installers may write to any location; options such as --appdir are ignored. ==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", "/usr/local/Caskroom/vfuse/1.0.3/vfuse-1.0.3.pkg", "-target", "/", "-verboseR"] ==> installer: Package name is vfuse-1.0.3 ==> installer: Installing at base path / ==> installer:PHASE:Preparing for installation… ==> installer:PHASE:Preparing the disk… ==> installer:PHASE:Preparing vfuse-1.0.3… ==> installer:PHASE:Waiting for other installations to complete… ==> installer:PHASE:Configuring the installation… ==> installer:STATUS: ==> installer:%2.229250 ==> installer:PHASE:Validating packages… ==> installer:%97.750000 ==> installer:STATUS: ==> installer:PHASE:Finishing the Installation… ==> installer:STATUS: ==> installer:%100.000000 ==> installer:PHASE:The software was successfully installed. ==> installer: The install was successful. ==> Installing artifact of class Hbc::Artifact::Binary ==> Linking Binary 'vfuse' to '/usr/local/bin/vfuse'. ==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/usr/local/vfuse/vfuse", "/usr/local/bin/vfuse"] ==> Purging files for version 1.0.3 of Cask vfuse Error: Operation not permitted - /usr/local/vfuse/vfuse Follow the instructions here: https://github.com/caskroom/homebrew-cask#reporting-bugs /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1333:in `chmod' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1333:in `chmod' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:975:in `block in chmod' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:974:in `each' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:974:in `chmod' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/binary.rb:12:in `link' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb:48:in `block in each_artifact' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/set.rb:232:in `each_key' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/set.rb:232:in `each' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb:46:in `each_artifact' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb:15:in `install_phase' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/binary.rb:7:in `install_phase' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:144:in `block in install_artifacts' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:141:in `each' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:141:in `install_artifacts' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:87:in `install' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:25:in `block in install_casks' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:19:in `each' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:19:in `install_casks' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:10:in `run' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:115:in `run_command' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:158:in `process' /usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask' /usr/local/Homebrew/Library/Homebrew/brew.rb:91:in `
' Error: Kernel.exit /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:169:in `exit' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:169:in `rescue in process' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:149:in `process' /usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask' /usr/local/Homebrew/Library/Homebrew/brew.rb:91:in `
' ```
karabiner ``` brew cask install karabiner --verbose --debug ==> Hbc::Installer#install ==> Printing caveats ==> Hbc::Installer#fetch ==> Downloading ==> Downloading https://pqrs.org/osx/karabiner/files/Karabiner-10.22.0.dmg ==> Calling curl with args ["https://pqrs.org/osx/karabiner/files/Karabiner-10.22.0.dmg", "-C", "0", "-o", "#"] /usr/bin/curl --remote-time --location --user-agent Homebrew/1.1.12 (Macintosh; Intel macOS 10.12.4) curl/7.51.0 --fail https://pqrs.org/osx/karabiner/files/Karabiner-10.22.0.dmg -C 0 -o /Users/commitay/Library/Caches/Homebrew/Cask/karabiner--10.22.0.dmg.incomplete % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 4261k 100 4261k 0 0 377k 0 0:00:11 0:00:11 --:--:-- 775k ==> Downloaded to -> /Users/commitay/Library/Caches/Homebrew/Cask/karabiner--10.22.0.dmg ==> Verifying download ==> Determining which verifications to run for Cask karabiner ==> Checking for verification class Hbc::Verify::Checksum ==> 1 verifications defined Hbc::Verify::Checksum ==> Running verification of class Hbc::Verify::Checksum ==> Verifying checksum for Cask karabiner ==> SHA256 checksums match ==> Hbc::Installer#stage ==> Extracting primary container ==> Determining which containers to use based on filetype ==> Checking container class Hbc::Container::Pkg ==> Checking container class Hbc::Container::Ttf ==> Checking container class Hbc::Container::Otf ==> Checking container class Hbc::Container::Air ==> Checking container class Hbc::Container::Cab ==> Checking container class Hbc::Container::Dmg ==> Executing: ["/usr/bin/hdiutil", "imageinfo", "/Users/commitay/Library/Caches/Homebrew/Cask/karabiner--10.22.0.dmg"] ==> Using container class Hbc::Container::Dmg for /Users/commitay/Library/Caches/Homebrew/Cask/karabiner--10.22.0.dmg ==> Executing: ["/usr/bin/hdiutil", "mount", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", "/tmp", "/Users/commitay/Library/Caches/Homebrew/Cask/karabiner--10.22.0.dmg"] ==> Executing: ["/usr/bin/mkbom", "-s", "-i", "/var/folders/t5/btq1kqfx15q3h9f6xvb0bk6c0000gn/T/20170405-1659-1xdcd3i.list", "--", "/var/folders/t5/btq1kqfx15q3h9f6xvb0bk6c0000gn/T/20170405-1659-atpuxo.bom"] ==> Executing: ["/usr/bin/ditto", "--bom", "/var/folders/t5/btq1kqfx15q3h9f6xvb0bk6c0000gn/T/20170405-1659-atpuxo.bom", "--", "/private/tmp/dmg.lYyRzv", "/usr/local/Caskroom/karabiner/10.22.0"] ==> Executing: ["/usr/sbin/diskutil", "eject", "/private/tmp/dmg.lYyRzv"] ==> Creating metadata directory /usr/local/Caskroom/karabiner/.metadata/10.22.0/20170405014025.740 ==> Creating metadata subdirectory /usr/local/Caskroom/karabiner/.metadata/10.22.0/20170405014025.740/Casks ==> Installing artifacts ==> Determining which artifacts are present in Cask karabiner ==> 4 artifact/s defined # # # # ==> Installing artifact of class Hbc::Artifact::Pkg ==> Running installer for karabiner; your password may be necessary. ==> Package installers may write to any location; options such as --appdir are ignored. ==> Executing: ["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", "/usr/local/Caskroom/karabiner/10.22.0/Karabiner.sparkle_guided.pkg", "-target", "/", "-verboseR"] ==> installer: Package name is Karabiner 10.22.0 ==> installer: Installing at base path / ==> installer:PHASE:Preparing for installation… ==> installer:PHASE:Preparing the disk… ==> installer:PHASE:Preparing Karabiner 10.22.0… ==> installer:PHASE:Waiting for other installations to complete… ==> installer:PHASE:Configuring the installation… ==> installer:STATUS: ==> installer:%34.784540 ==> installer:PHASE:Running package scripts… ==> installer:%36.738984 ==> installer:PHASE:Running package scripts… ==> installer:%38.601496 ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:%82.838184 ==> installer:PHASE:Running package scripts… ==> installer:%84.793122 ==> installer:PHASE:Running package scripts… ==> installer:%85.381549 ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Running package scripts… ==> installer:PHASE:Validating packages… ==> installer:%97.262500 ==> installer:PHASE:Registering updated applications… ==> installer:%97.750000 ==> installer:STATUS:Running installer actions… ==> installer:STATUS: ==> installer:PHASE:Finishing the Installation… ==> installer:STATUS: ==> installer:%100.000000 ==> installer:PHASE:The software was successfully installed. ==> installer: The install was successful. ==> Installing artifact of class Hbc::Artifact::Binary ==> Linking Binary 'karabiner' to '/usr/local/bin/karabiner'. ==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/Applications/Karabiner.app/Contents/Library/bin/karabiner", "/usr/local/bin/karabiner"] ==> Purging files for version 10.22.0 of Cask karabiner Error: Operation not permitted - /Applications/Karabiner.app/Contents/Library/bin/karabiner Follow the instructions here: https://github.com/caskroom/homebrew-cask#reporting-bugs /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1333:in `chmod' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1333:in `chmod' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:975:in `block in chmod' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:974:in `each' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:974:in `chmod' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/binary.rb:12:in `link' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb:48:in `block in each_artifact' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/set.rb:232:in `each_key' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/set.rb:232:in `each' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/relocated.rb:46:in `each_artifact' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb:15:in `install_phase' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/artifact/binary.rb:7:in `install_phase' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:144:in `block in install_artifacts' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:141:in `each' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:141:in `install_artifacts' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/installer.rb:87:in `install' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:25:in `block in install_casks' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:19:in `each' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:19:in `install_casks' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/install.rb:10:in `run' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:115:in `run_command' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:158:in `process' /usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask' /usr/local/Homebrew/Library/Homebrew/brew.rb:91:in `
' Error: Kernel.exit /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:169:in `exit' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:169:in `rescue in process' /usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:149:in `process' /usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask' /usr/local/Homebrew/Library/Homebrew/brew.rb:91:in `
' ```
commitay commented 7 years ago

Found a possible cause for this.

I've tried this with all the casks I mention in the previous post, the ones that had errors now work properly and it doesn't seem to impact any of the others.

Removing this allows the symlinks to be created without error.

==> installer:PHASE:The software was successfully installed.
==> installer: The install was successful.
==> Installing artifact of class Hbc::Artifact::Binary
==> Linking Binary 'metasploit-aggregator' to '/usr/local/bin/metasploit-aggregator'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/metasploit-aggregator", "/usr/local/bin/metasploit-aggregator"]
==> Linking Binary 'msfbinscan' to '/usr/local/bin/msfbinscan'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfbinscan", "/usr/local/bin/msfbinscan"]
==> Linking Binary 'msfconsole' to '/usr/local/bin/msfconsole'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfconsole", "/usr/local/bin/msfconsole"]
==> Linking Binary 'msfd' to '/usr/local/bin/msfd'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfd", "/usr/local/bin/msfd"]
==> Linking Binary 'msfdb' to '/usr/local/bin/msfdb'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfdb", "/usr/local/bin/msfdb"]
==> Linking Binary 'msfelfscan' to '/usr/local/bin/msfelfscan'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfelfscan", "/usr/local/bin/msfelfscan"]
==> Linking Binary 'msfmachscan' to '/usr/local/bin/msfmachscan'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfmachscan", "/usr/local/bin/msfmachscan"]
==> Linking Binary 'msfpescan' to '/usr/local/bin/msfpescan'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfpescan", "/usr/local/bin/msfpescan"]
==> Linking Binary 'msfremove' to '/usr/local/bin/msfremove'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfremove", "/usr/local/bin/msfremove"]
==> Linking Binary 'msfrop' to '/usr/local/bin/msfrop'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfrop", "/usr/local/bin/msfrop"]
==> Linking Binary 'msfrpc' to '/usr/local/bin/msfrpc'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfrpc", "/usr/local/bin/msfrpc"]
==> Linking Binary 'msfrpcd' to '/usr/local/bin/msfrpcd'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfrpcd", "/usr/local/bin/msfrpcd"]
==> Linking Binary 'msfupdate' to '/usr/local/bin/msfupdate'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfupdate", "/usr/local/bin/msfupdate"]
==> Linking Binary 'msfvenom' to '/usr/local/bin/msfvenom'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfvenom", "/usr/local/bin/msfvenom"]
🍺  metasploit was successfully installed!
vitorgalvao commented 7 years ago

Couldn’t look at this in depth, but I suspect the issue might lie in us not being able to chmod something in /opt for lack of permissions. That’s the difference between this cask and the others. @commitay Mind checking the permissions/ownership of those directories?

Solution might be to create /opt/metasploit-framework/bin and give ourselves permissions on it in a preflight.

If no one does it in the meantime, I’ll take a look tomorrow if I have time. Good night, everyone!

commitay commented 7 years ago

Good night, everyone!

Good night, @vitorgalvao!

Mind checking the permissions/ownership of those directories?

drwxr-xr-x   8 root  wheel   272B  6 Apr 12:24 metasploit-framework
-rw-r--r--    1 root  wheel    34K  4 Apr 19:38 LICENSE
drwxr-xr-x  145 root  wheel   4.8K  4 Apr 19:38 LICENSES
drwxr-xr-x   16 root  wheel   544B  4 Apr 19:38 bin
drwxr-xr-x    9 root  wheel   306B  4 Apr 19:35 embedded
-rw-r--r--    1 root  wheel   8.2K  4 Apr 19:38 version-manifest.json
-rw-r--r--    1 root  wheel   3.7K  4 Apr 19:38 version-manifest.txt

Solution might be to create /opt/metasploit-framework/bin and give ourselves permissions on it in a preflight.

I'm not sure if I've done these correctly, I copied them from examples in the docs.

Manually created /opt/metasploit-framework/bin with sudo mkdir -p before each installation.

set_permissions
  preflight do
    set_permissions '/opt/metasploit-framework/bin', '0755'
  end
==> installer: The install was successful.
==> Installing artifact of class Hbc::Artifact::Binary
==> Linking Binary 'metasploit-aggregator' to '/usr/local/bin/metasploit-aggregator'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/metasploit-aggregator", "/usr/local/bin/metasploit-aggregator"]
==> Reverting installation of artifact of class Hbc::Artifact::PreflightBlock
==> Purging files for version 4.14.8,20170404092313 of Cask metasploit
Error: Operation not permitted - /opt/metasploit-framework/bin/metasploit-aggregator
set_ownership
  preflight do
    set_ownership '/opt/metasploit-framework/bin'
  end
==> installer: The install was successful.
==> Installing artifact of class Hbc::Artifact::Binary
==> Linking Binary 'metasploit-aggregator' to '/usr/local/bin/metasploit-aggregator'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/metasploit-aggregator", "/usr/local/bin/metasploit-aggregator"]
==> Reverting installation of artifact of class Hbc::Artifact::PreflightBlock
==> Purging files for version 4.14.8,20170404092313 of Cask metasploit
Error: Operation not permitted - /opt/metasploit-framework/bin/metasploit-aggregator

but I suspect the issue might lie in us not being able to chmod

I think it might be FileUtils.chmod "+x", source failing as if it is replaced with @command.run!("/bin/chmod", args: ["+x", source]) it works without any changes to the cask.

==> installer: The install was successful.
==> Installing artifact of class Hbc::Artifact::Binary
==> Linking Binary 'metasploit-aggregator' to '/usr/local/bin/metasploit-aggregator'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/metasploit-aggregator", "/usr/local/bin/metasploit-aggregator"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/metasploit-aggregator"]
==> Linking Binary 'msfbinscan' to '/usr/local/bin/msfbinscan'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfbinscan", "/usr/local/bin/msfbinscan"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfbinscan"]
==> Linking Binary 'msfconsole' to '/usr/local/bin/msfconsole'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfconsole", "/usr/local/bin/msfconsole"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfconsole"]
==> Linking Binary 'msfd' to '/usr/local/bin/msfd'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfd", "/usr/local/bin/msfd"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfd"]
==> Linking Binary 'msfdb' to '/usr/local/bin/msfdb'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfdb", "/usr/local/bin/msfdb"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfdb"]
==> Linking Binary 'msfelfscan' to '/usr/local/bin/msfelfscan'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfelfscan", "/usr/local/bin/msfelfscan"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfelfscan"]
==> Linking Binary 'msfmachscan' to '/usr/local/bin/msfmachscan'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfmachscan", "/usr/local/bin/msfmachscan"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfmachscan"]
==> Linking Binary 'msfpescan' to '/usr/local/bin/msfpescan'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfpescan", "/usr/local/bin/msfpescan"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfpescan"]
==> Linking Binary 'msfremove' to '/usr/local/bin/msfremove'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfremove", "/usr/local/bin/msfremove"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfremove"]
==> Linking Binary 'msfrop' to '/usr/local/bin/msfrop'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfrop", "/usr/local/bin/msfrop"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfrop"]
==> Linking Binary 'msfrpc' to '/usr/local/bin/msfrpc'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfrpc", "/usr/local/bin/msfrpc"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfrpc"]
==> Linking Binary 'msfrpcd' to '/usr/local/bin/msfrpcd'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfrpcd", "/usr/local/bin/msfrpcd"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfrpcd"]
==> Linking Binary 'msfupdate' to '/usr/local/bin/msfupdate'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfupdate", "/usr/local/bin/msfupdate"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfupdate"]
==> Linking Binary 'msfvenom' to '/usr/local/bin/msfvenom'.
==> Executing: ["/bin/ln", "-h", "-f", "-s", "--", "/opt/metasploit-framework/bin/msfvenom", "/usr/local/bin/msfvenom"]
==> Executing: ["/bin/chmod", "+x", "/opt/metasploit-framework/bin/msfvenom"]
🍺  metasploit was successfully installed!
vitorgalvao commented 7 years ago

I think it might be FileUtils.chmod "+x", source failing as if it is replaced with @command.run!("/bin/chmod", args: ["+x", source]) it works without any changes to the cask.

Ping @reitermarkus.

deiga commented 7 years ago

So what's a sensible workaround for this issue, while you're working on a fix?

commitay commented 7 years ago
brew cask install metasploit --no-binaries

will allow the installation to complete.

Add /opt/metasploit-framework/bin to your path manually.

creasty commented 7 years ago

--no-binaries will allow the installation to complete.

Couldn't get karabiner installed even with --no-binaries option.

commitay commented 7 years ago

Couldn't get karabiner installed even with --no-binaries option.

That is likely to be a separate problem, please follow the instructions here: reporting-bugs and then open a new issue if needed.

Sorry @creasty, I didn't see that you referenced another issue. I'm not sure why --no-binaries isn't working in your case.

reitermarkus commented 7 years ago

I think it might be FileUtils.chmod "+x", source failing as if it is replaced with @command.run!("/bin/chmod", args: ["+x", source]) it works without any changes to the cask.

Does @command.run!("/bin/chmod", args: ["+x", source]) work without sudo? Might be because is skips it if it already is executable?

@commitay, would you mind submitting a PR with this over at https://github.com/homebrew/brew? Thanks!

commitay commented 7 years ago

Does @command.run!("/bin/chmod", args: ["+x", source]) work without sudo? Might be because is skips it if it already is executable?

I'm not sure how sudo would be passed to chmod in this case.

I've tested replacing the FileUtils.chmod with /bin/chmod which works, but I've also tried commenting FileUtils.chmod out and that also creates working symlinks. Do you mean a install which requires sudo?

would you mind submitting a PR with this over at https://github.com/homebrew/brew

@reitermarkus, I'll submit a PR and mark it WIP as I'm not sure how to modify binary_spec.rb so it passes brew tests.

reitermarkus commented 7 years ago

I'm not sure how sudo would be passed to chmod in this case.

@command.run!("/bin/chmod", args: ["+x", source], sudo: true)

Under the hood this is basically the same as system_command in Casks.

commitay commented 7 years ago

@command.run!("/bin/chmod", args: ["+x", source], sudo: true)

sudo: true is not required for the casks I've tested this with.

reitermarkus commented 7 years ago

sudo: true is not required for the casks I've tested this with.

I suspect that the reason that you don't need sudo is that these binaries are already executable, so chmod skips it, instead of asking for permission. Try chmod -x on one of those.

commitay commented 7 years ago

I suspect that the reason that you don't need sudo is that these binaries are already executable, so chmod skips it, instead of asking for permissions.

You're right, chmod -x fails without sudo but works with sudo.