Homebrew: Pre-downloading a file for a formula - macos

I was trying to install gtk via Homebrew, and one of the steps was to install glib. Due to the poor internet environment, the files cannot be accessed by Homebrew. As told in https://docs.brew.sh/Tips-N%27-Tricks#pre-downloading-a-file-for-a-formula, I downloaded glib-2.62.3.tar.xz manually, and renamed it to /Users/username/Library/Caches/Homebrew/downloads/1ceb5460421ff37cf2c270573cd81d23a3fc0629114ebe78eee705acbd80c9e7--glib-2.62.3.tar.xz, which is the output of brew --cache -s glib.
However, as I run brew install glib again, the message was:
==> Downloading https://download.gnome.org/sources/glib/2.62/glib-2.62.3.tar.xz
Already downloaded: /Users/xwm/Library/Caches/Homebrew/downloads/1ceb5460421ff37cf2c270573cd81d23a3fc0629114ebe78eee705acbd80c9e7--glib-2.62.3.tar.xz
==> Downloading https://raw.githubusercontent.com/Homebrew/formula-patches/61642
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
Error: An exception occurred within a child process:
DownloadError: Failed to download resource "glib--patch"
Download failed: https://raw.githubusercontent.com/Homebrew/formula-patches/6164294a7/glib/hardcoded-paths.diff
Although this file can be retrived manually, by this time I have no idea how to reaname it so as to be recongnized by Homebrew. How should I proceed?

Related

How to install php-redis extension on mac os 10.13?

For a few days I'm trying to install php-redis extension.
Try use brew and getting this...
$ brew install php71-redis
Error: No available formula with the name "php71-redis"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
Trying to install with PECL and getting this...
$ sudo pecl install redis
downloading redis-4.1.0.tgz ...
Starting to download redis-4.1.0.tgz (220,774 bytes)
..............................................done: 220,774 bytes
25 source files, building
running: phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
************
************
checking whether to enable igbinary serializer support... yes
checking whether to enable lzf compression... yes
checking use system liblzf... no
checking for igbinary includes... configure: error: Cannot find igbinary.h
ERROR: `/private/tmp/pear/install/redis/configure --with-php-config=/usr/bin/php-config --enable-redis-igbinary=нуы --enable-redis-lzf=yes' failed
and finally trying to install igbinary.h ....
$ sudo pecl install igbinary
downloading igbinary-2.0.7.tgz ...
Starting to download igbinary-2.0.7.tgz (73,523 bytes)
************
************
Build process completed successfully
Installing '/usr/include/php/ext/igbinary/igbinary.h'
ERROR: failed to mkdir /usr/include/php/ext/igbinary
I just did this on Mac OS 10.13 (I'm still using High Sierra).
With homebrew php7.2 and up, pecl is now installed by default alongside the php binaries.
To see this for yourself type which pecl.
Steps to install
Check your version of redis, then find a suitable version of the extension here.
If unfamiliar with pecl, type pecl to see the options.
Issue pecl install redis 5.0.2. (or your version). Enter no to each question asked if you're not sure.
If that succeeds check the new file it created at: /usr/local/lib/php/pecl/20180731/redis.so
The install will have added extension="redis.so" to top of your php ini.
Check that by opening the file /usr/local/etc/php/7.3/php.ini.
(assuming you're on 7.3 there)
brew services restart php.
php -i | grep Redis
Redis Support => enabled
Redis Version => 5.0.2
Did this in September 2019 and it works for me.
For this, try to disable the csrutil on OSx (Mac):
Reboot your Mac
When the Mac starts, typo Command + R until you get into recovery mode
In the recovery mode, go to utilities and select terminal
in the terminal type csrutil disable
Reboot your mac and redo the redis install by pecl
Should work.

How can I install ngrok on OS X El Capitan?

First I tried downloading from the website, ngrok-stable-darwin-amd64.zip. When I try unzipping via Terminal, I get:
Archive: /Users/User/Downloads/ngrok-stable-darwin-amd64.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /Users/User/Downloads/ngrok-stable-darwin-amd64.zip or
/Users/User/Downloads/ngrok-stable-darwin-amd64.zip.zip, and cannot find /Users/User/Downloads/ngrok-stable-darwin-amd64.zip.ZIP, period.
Unzipping with Unarchiver responds with:
There was a problem while reading the contents of the file
"ngrok-stable-darwin-amd64.zip": Data is corrupted
Tried the homebrew route, brew cask install ngrok, to no avail:
==> Downloading https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.z
##### 7.0%
curl: (56) SSLRead() return error -9806
Error: Download failed on Cask 'ngrok' with message: Download failed: https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-darwin-amd64.zip
The incomplete download is cached at /Users/User/Library/Caches/Homebrew/Cask/ngrok--2.1.3,4VmDzA7iaHb.zip.incomplete
I'm trying to enable Vagrant share. Why can't I install ngrok, or more importantly, how can I?
Please & thanks.
You can install ngrok as a global npm package. Try this:
npm install ngrok -g
For more information visit check this page.

Why is curl (launched by homebrew) looking in .nix-profile?

A while back I had nix installed but I have removed it, however now when I try to install threadscope I get the follwowing error:
Henriks-MBP:trial henke$ brew install homebrew/gui/Threadscope
==> Installing threadscope from homebrew/gui
==> Installing dependencies for homebrew/gui/threadscope: libpng, freetype, fontconfig, pixman, gettext, libffi, glib, cairo, ghc, jpeg, libtiff, gobject-introspection, gdk-p
==> Installing homebrew/gui/threadscope dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.21.el_capitan.bottle.tar.gz
curl: (77) SSL: can't load CA certificate file /Users/henke/.nix-profile/etc/ssl/certs/ca-bundle.crt
Error: Failed to download resource "libpng"
Download failed: https://homebrew.bintray.com/bottles/libpng-1.6.21.el_capitan.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.21.tar.xz
curl: (19) Given file does not exist
Trying a mirror...
==> Downloading https://dl.bintray.com/homebrew/mirror/libpng-1.6.21.tar.xz
curl: (77) SSL: can't load CA certificate file /Users/henke/.nix-profile/etc/ssl/certs/ca-bundle.crt
Error: Failed to download resource "libpng"
Download failed: https://dl.bintray.com/homebrew/mirror/libpng-1.6.21.tar.xz
Now why is homebrew trying to find things in .nix-profile and what can I do to install threadscopes dependencies?
This isn't homebrew specifically looking into the .nix-profile directory. This is a fragment of having nix installed.
When you installed nix, it installed its own CA certs. Check the value of SSL_CERT_FILE. in my case:
$ echo $SSL_CERT_FILE
/Users/my-user/.nix-profile/etc/ssl/certs/ca-bundle.crt
I have have had issues with this cert when attempting to use curl with https, which is what homebrew is doing.
I'm assuming you just recently removed nix and still have that variable set in your shell. If you just close any currently open shells and open brand new ones, this should be fixed.
You could also try unset SSL_CERT_FILE in any open shells instead of closing / opening them all.

How to install rsync on mac while samba.org is down

(! 516)-> brew install rsync
==> Installing rsync from homebrew/homebrew-dupes
==> Downloading https://rsync.samba.org/ftp/rsync/rsync-3.1.1.tar.gz
curl: (7) Failed to connect to rsync.samba.org port 443: Operation timed out
Error: Failed to download resource "rsync"
Download failed: https://rsync.samba.org/ftp/rsync/rsync-3.1.1.tar.gz
Entire https://www.samba.org/ is down.
Any idea / alternative how to install rsync on Mac right now?
Thanks!
Just picking a random mirror (from the Gentoo linux distribution in this case):
https://mirrors.kernel.org/gentoo/distfiles/rsync-3.1.1.tar.gz
You could browse through the repositories of most large distributions and find various copies of the latest rsync source tar there. Source code should work on all distributions, including Mac OSX. It's the same "tarball" samba.org normally hosts.
You probably have to run brew edit rsync to modify the formula, if you want to install it with homebrew. Homebrew uses little scripts called formulas, written in Ruby, which tell it where to find source code, what to do with it, and how to install it.
Just replace the https://rsync.samba.org/ftp/rsync/rsync-3.1.1.tar.gz lines with https://mirrors.kernel.org/gentoo/distfiles/rsync-3.1.1.tar.gz in that script for the time being.

Macports/rvm/svn connection issue behind a proxy and firewall

I am behind a corporate firewall that won't let me rsync out, and requires a proxy for HTTP/HTTPS. I'm having trouble with rvm breaking at the macports step in this environment.
To summarise:
I am trying to do rvm install ruby-1.9.3-p286
rvm wants to use macports.
macports wants to update using rsync, but I can't rsync out.
I set up a local macports source repo, but it doesn't seem to help - macports still wants to use rsync.
A suggestion on a similar question suggested changing port selfupdate to port sync in rvm's scripts. But that didn't help - macports then dies trying to do an svn update
But I can do the svn update manually fine, so I don't understand where the problem is.
Here are the details:
I followed this guide for using macports behind a firewall, by checking out the repo locally, and setting the following in /opt/local/etc/macports/sources.conf.
#rsync://rsync.macports.org/release/tarballs/ports.tar [default]
file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/ [default]
The only place I differed from the guide was I installed macports for 10.8 rather than 10.5.
However, rvm's macports seems to still use rsync for some reason:
$ rvm install ruby-1.9.3-p286
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Password:
DEBUG: Copying /Users/tim/Library/Preferences/com.apple.dt.Xcode.plist to
/opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location:
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs ---> Updating MacPorts base sources using rsync
rsync: failed to connect to rsync.macports.org: Connection refused (61)
rsync error: error in socket IO (code 10) at /SourceCache/rsync/rsync-42/rsync/clientserver.c(105) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
Exit code: 10
DEBUG: Error synchronizing MacPorts sources: command execution failed
while executing
"macports::selfupdate [array get global_options] base_updated"
Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: command execution failed
This is very similar to this question, where the answer suggested the following change:
$ diff -u .rvm/scripts/functions/requirements/osx_port.org .rvm/scripts/functions/requirements/osx_port
--- .rvm/scripts/functions/requirements/osx_port.org 2013-05-28 16:58:37.000000000 +0900
+++ .rvm/scripts/functions/requirements/osx_port 2013-05-28 16:58:50.000000000 +0900
## -82,7 +82,7 ##
requirements_osx_port_update_system()
{
- __rvm_try_sudo port -dv selfupdate || return $?
+ __rvm_try_sudo port -dv sync || return $?
}
requirements_osx_port_define()
Unfortunately, that results in the following:
$ rvm install ruby-1.9.3-p286
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Password:
DEBUG: Copying /Users/tim/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
---> Updating the ports tree
Synchronizing local ports tree from file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/
DEBUG: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
DEBUG: changing euid/egid - current euid: 0 - current egid: 0
svn: OPTIONS of 'http://svn.macports.org/repository/macports/trunk/dports': could not connect to server (http://svn.macports.org)
Command failed: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
Exit code: 1
DEBUG: command execution failed
while executing
"system $svn_commandline"
Error: Synchronization of the local ports tree failed doing an svn update
DEBUG: Synchronization of 1 source(s) failed
while executing
"mportsync [array get global_options]"
port sync failed: Synchronization of 1 source(s) failed
Trying directly with macports:
$ port -d sync
---> Updating the ports tree
Synchronizing local ports tree from file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/
DEBUG: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
svn: OPTIONS of 'http://svn.macports.org/repository/macports/trunk/dports': could not connect to server (http://svn.macports.org)
Command failed: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
Exit code: 1
DEBUG: command execution failed
while executing
"system $svn_commandline"
Error: Synchronization of the local ports tree failed doing an svn update
DEBUG: Synchronization of 1 source(s) failed
while executing
"mportsync [array get global_options]"
port sync failed: Synchronization of 1 source(s) failed
This is strange, because I can run that svn command fine:
$ /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
At revision 107532.
It's not a user permissions/profile issue, because root can run that svn command fine too:
$ sudo /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
At revision 107532.
I assume something in the chain isn't seeing the proxy correctly. However:
My proxy is correctly set in the http_proxy and https_proxy environment variables
It is also set in ~/.subversion/servers (as the variables http-proxy-host and http-proxy-port in the [global] section)
And it is also set in /opt/local/etc/macports/macports.conf (as the variables proxy_http and proxy_https)
Other information:
ruby 1.8.7
rvm 1.21.4
OSX 10.8.3
MacPorts 2.1.3
Let me know if there's any other information that could be useful.
My question is How can I get port sync to work in this environment? (Which I am hoping will also fix rvm)
As a workaround to get you going try:
rvm autolbs read-fail
It will not install packages automatically - it will fail in case any packages are missing and will let you know names of this packages, just install them manually with macports and it should be fine.
Other solution would be switching to:
rvm autolibs homebrew
to use homebrew instead of macports, or:
rvm autolibs rvm_pkg
to detect what is already installed with pkg-config and try to install rest with the old rvm pkg install ....
More details on autolibs: http://rvm.io/rvm/autolibs

Resources