What does Homebrew "-vd" argument mean? - arguments

Could someone please explain the "-vd" argument used for brew commands? For example,
brew install --build-from-source --with-python -vd protobuf
Thank you.

It is possible to combine flags so -vd is shorthand for -v and -d. Looking at the documentation for Homebrew (https://docs.brew.sh/Manpage) shows us that for brew install -v means verbose and -d means debug.

Related

CMAKE for opencv 3.0 installing don't find python3

I'm trying to install opencv 3.0 on MacOS 10.13 and when I use that instructions:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D PYTHON3_LIBRARY=YYY \
-D PYTHON3_INCLUDE_DIR=ZZZ \
-D PYTHON3_EXECUTABLE=$VIRTUAL_ENV/bin/python \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D BUILD_EXAMPLES=ON ..
The installation don't find my python 3 compiler and shows me that:
Python 3:
-- Interpreter: NO
-- Libraries: NO
-- numpy: NO (Python3 wrappers can not be generated)
-- packages path:
How may I fix it to find the python 3 compiler?
I've installed the python3 using "brew install python3"
You probably need to provide full paths. Perhaps the $VIRTUAL_ENV part is your problem? Installing it with a virtualenv python3 (e.g. with numpy) may be a completely different problem altogether though.
-DBUILD_opencv_python3=ON
-DPYTHON3_EXECUTABLE=/full/path/to/bin/python3
-DPYTHON3_LIBRARY=/full/path/to/lib
-DPYTHON3_INCLUDE_DIR=/full/path/to/include
-DBUILD_opencv_python2=OFF
You mentioned OSX with brew, so you may also be missing a slightly arcane path issue here. On my system I have installed python3 with brew, the version I have installed is 3.6.2. So these paths actually need to be
/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/bin/python3
/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib
/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/include/
The Frameworks stuff is an OSX specific thing, but the bin/ folder gets symlinked up to /usr/local/Cellar/python3/3.6.2 whereas the others (lib and include) do not
HOWEVER
Why not just use brew to install it? brew info opencv shows opencv.rb, which will use python3. That may be the path of least resistance here ;)
Note that OpenCV is "bottled", which means by default brew will try and install the bottle first. It's generally better to install OpenCV from source (it gets compiled to your specific machine), so you will want to
brew install --build-from-source opencv
Of course this will take significantly longer to install!
Update: you may not have opencv available directly in brew yet, to get it you need to
brew tap homebrew/science
brew install --build-from-source opencv
More information on that and what comes with homebrew/science here.
I had the same problem as the topic starter, and the way with brew worked for me.
The only thing:
brew install --build-from-source opencv installed opencv for python2
brew install --build-from-source opencv3 worked for python3

pdfgrep: how to install pdfgrep on Mac

I am trying to make a regex search on a pdf file on Mac.
For that, I'm trying to install pdfgrep. I have cloned the repository, but I'm not sure how to install it.
On the README, it says to
use the standard procedure:
./configure
make
sudo make install
,but just running these commands doesn't make the installation.
Can anyone help me?
use brew install pdfgrep or install macports and run port install pdfgrep
running brew install pdfgrep worked for me :)
If you want to use the regular expression (PCRE) option, please use brew install pdfgrep --with-pcre. Or brew reinstall pdfgrep --with-pcre if you already installed pdfgrep.

Installing Ruby 1.8.7 on Mac Os C 10.9.2

I need to install ruby 1.8.7 on Mac Os x 10.9. I have run into several problems and have not found the answer. I have X code 5.1.1 and command line tools installed. What ever I do, I always get this same error message:
$ rvm install 1.8.7
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-1.8.7-p374.
It is not possible to build movable binaries for rubies 1.8-1.9.2, but you can do it for your system only.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx_brew.
Installing requirements for osx_brew.
Updating system....
Installing required packages: autoconf, automake, libtool, pkg-config, gcc46, libyaml, readline, libksba, openssl098...
Error running 'requirements_osx_brew_libs_install autoconf automake libtool pkg-config gcc46 libyaml readline libksba openssl098',
showing last 15 lines of /Users/elisabethwork/.rvm/log/1399001508_ruby-1.8.7-p374/package_install_autoconf_automake_libtool_pkg-config_gcc46_libyaml_readline_libksba_openssl098.log
++ case "$1" in
++ [[ -t 1 ]]
++ return 1
++ printf %b 'There were package installation errors, make sure to read the log.
Try `brew tap --repair` and make sure `brew doctor` looks reasonable.
Check Homebrew requirements https://github.com/mxcl/homebrew/wiki/Installation\n'
There were package installation errors, make sure to read the log.
Try `brew tap --repair` and make sure `brew doctor` looks reasonable.
Check Homebrew requirements https://github.com/mxcl/homebrew/wiki/Installation
++ case "$_system_version" in
++ return 1
Requirements installation failed with status: 1.
$ brew doctor
Your system is ready to brew.
Can you help me? Thank you!
See this bash script which lets you switch between 1.8.7 en 2.0. No RVM, brew or other extra software needed: https://gist.github.com/mipmip/7cfbadfcfa5fabe0ba84
for my case. I previously installed the autoconf libtool module myself and home-brew want to override that. so you have to manually tell brew that.
brew link --overwrite autoconf
...
you should run brew doctor and spend sometime read keywords like: error,build

Detect if homebrew package is installed

I'm about to write a shell script to detect if several homebrew packages are installed in the system. Is there a way to use a brew command to achieve that?
I tried using the exit code of brew install <formula> --dry-run. But this builds the package if it is missing.
You can use
brew ls --versions myformula
to output the installed versions of the respective formula. If the formula is not installed, the output will be empty.
When using a recent versions of homebrew, which you can get with brew update, you can just run this (thanks Slaven):
if brew ls --versions myformula > /dev/null; then
# The package is installed
else
# The package is not installed
fi
That said, it is probably a good idea to check for the existence of the tool at all and not just checking for the respective homebrew package (e.g. by searching for the executable in the $PATH). People tend to install tools in a rather large amount of ways in practice, with homebrew being just one of them.
# install if we haven't installed any version
brew ls --versions $lib || brew install $lib
# install if we haven't installed latest version
brew outdated $lib || brew install $lib
What about?
for pkg in macvim ngrep other needed packages; do
if brew list -1 | grep -q "^${pkg}\$"; then
echo "Package '$pkg' is installed"
else
echo "Package '$pkg' is not installed"
fi
done
Easiest two-liners:
Step one, make sure it's installed
$ realpath . || brew install coreutils
This will print out the realpath of current dir, if not, then it will install it.
And it will not fail even realpath not found.
Step two, call it in your actual code:
$ realpath ${someDir}
For script and automation usage, I found out that brew bundle --help is very convenient.
If you do not want to use real bundle file, this snippet works fine in scripts:
brew bundle -v --file=- <<-EOF
brew "mc"
brew "ffmpeg"
brew "wget"
cask "cpuinfo"
cask "intel-power-gadget"
cask "unetbootin"
cask "vlc"
EOF
The good side of it, it will automatically detect if package is not installed, if it is outdated and only then will install it.
If you do not want updates, add a flag --no-upgrade. I have put -v for verbosity, as want more details, but you can skip it, or even use -q for even more silent run.

How to install JSON.pm perl module on OSX

I am trying to use the po2json parser/converter from the JS gettext library (http://jsgettext.berlios.de/), but when I try to convert I get this error:
Can't locate JSON.pm in #INC (#INC contains: /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at ./po2json line 23.
BEGIN failed--compilation aborted at ./po2json line 23.
As far as I understand I am missing a perl module, namely JSON.pm, an I think it's this one: http://cpansearch.perl.org/src/MAKAMAKA/JSON-2.53/lib/JSON.pm
Now, how do I install it on OSX? I am using Mountain Lion.
I tried to do cpan install JSON, but it doesn't work, I get the following error:
Writing Makefile for JSON
MAKAMAKA/JSON-2.53.tar.gz
make -- NOT OK
'YAML' not installed, will not store persistent state
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Use homebrew to install cpanm:
brew install cpanm
Then you can install JSON with
sudo cpanm install JSON
The output said that make didn't return success. Probably due to some dependency.
Try using cpanm http://search.cpan.org/~miyagawa/App-cpanminus-1.5017/bin/cpanm, it's really hassle free and bootstrapped quite well (no need to install other stuff).
Install using this:
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
cpan install JSON Having the JSON in all caps made it work for me.
I know this is an old topic, but wanted to share my solution after finding that I needed JSON when trying to use zap2xml (perl based). I was getting the error: "Can't locate JSON.pm in #INC..." after installing perl via Homebrew.
This is how I installed JSON via Homebrew. I will also include the steps required to install Homebrew (for those who would like to know). ;)
Prerequisites:
Install Xcode from the App Store (Download):
https://itunes.apple.com/us/app/xcode/id497799835
Install Command Line Tools for Xcode (Run in Terminal):
xcode-select --install
Install Homebrew (Run in Terminal):
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Update Homebrew (Run in Terminal):
brew update
brew upgrade
brew doctor (correct issues found by brew doctor. Instructions will be given by The Doctor. :P)
Install cpanminus (Run in Terminal):
brew install cpanm
Check perl (Run in Terminal):
which perl
perl -V (with a capital -V)
Check/Install JSON module (Run in Terminal):
sudo cpanm -v JSON
DONE.
Following worked for me:
Run on terminal:
sudo perl -MCPAN -e shell
you should get the cpan shell prompt and run below commond at cpan shell:
cpan[1]> install JSON
Regards,
Anand Choubey
this way is OK, Follows the Command:sudo apt-get install libjson-perl

Resources